Class: SimpleJSONAPIClient::Redirection::Proxy
- Inherits:
-
Object
- Object
- SimpleJSONAPIClient::Redirection::Proxy
show all
- Extended by:
- Forwardable
- Defined in:
- lib/simple_jsonapi_client/redirection/proxy.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
18
19
20
21
|
# File 'lib/simple_jsonapi_client/redirection/proxy.rb', line 18
def method_missing(meth, *args, &block)
self.class.def_delegator :internal_object, meth
internal_object.__send__(meth, *args, &block)
end
|
Instance Method Details
#as_json ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/simple_jsonapi_client/redirection/proxy.rb', line 27
def as_json
if internal_object.respond_to?(:as_json)
internal_object.as_json
elsif internal_object.is_a?(Array)
internal_object.map(&:as_json)
elsif nil?
nil
else
raise "Cannot convert #{inspect} to JSON!"
end
end
|
#inspect ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/simple_jsonapi_client/redirection/proxy.rb', line 10
def inspect
if @internal_object
@internal_object.inspect
else
pseudo_inspect
end
end
|
#respond_to_missing?(*args) ⇒ Boolean
23
24
25
|
# File 'lib/simple_jsonapi_client/redirection/proxy.rb', line 23
def respond_to_missing?(*args)
internal_object.__send__(:respond_to?, *args)
end
|