Last active
December 30, 2015 03:41
-
-
Save pmashchak/8d2a366c1687b482211b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
attr_accessor :options | |
cattr_accessor :name | |
def initialize | |
self.options = { code: 200, controller: OpenStruct.new(log_state: true) } | |
self.class.name = :api_name | |
end | |
end | |
class B | |
attr_accessor :api_context, :options | |
def initialize | |
self.options = {} | |
self.api_context = A.new | |
end | |
extend Forwardable | |
def_delegator :api_context, :options, :api_options | |
def_delegator :api_options, :[], :get | |
def_delegator :api_context, :name, :api_name | |
def_delegator :'api_options[:controller]', :log_state | |
def get_code | |
get(:code) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment