Class: KOSapiClient::RequestBuilderDelegator
- Inherits:
-
Object
- Object
- KOSapiClient::RequestBuilderDelegator
show all
- Defined in:
- lib/kosapi_client/request_builder_delegator.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RequestBuilderDelegator.
4
5
6
7
|
# File 'lib/kosapi_client/request_builder_delegator.rb', line 4
def initialize(request_builder)
@request_builder = request_builder
@response = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/kosapi_client/request_builder_delegator.rb', line 11
def method_missing(method, *args, &block)
if @response
delegate_to_response(method, *args, &block)
else
delegate_to_builder(method, *args, &block)
end
end
|
Instance Method Details
#respond_to_missing?(method, include_all) ⇒ Boolean
19
20
21
22
23
24
25
|
# File 'lib/kosapi_client/request_builder_delegator.rb', line 19
def respond_to_missing?(method, include_all)
if @response
@response.respond_to?(method, include_all)
else
@request_builder.respond_to?(method, include_all)
end
end
|
#super_method_missing ⇒ Object
9
|
# File 'lib/kosapi_client/request_builder_delegator.rb', line 9
alias :super_method_missing :method_missing
|