Class: GraphQL::Define::DefinedObjectProxy
- Inherits:
-
Object
- Object
- GraphQL::Define::DefinedObjectProxy
show all
- Defined in:
- lib/graphql/define/defined_object_proxy.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of DefinedObjectProxy.
5
6
7
8
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 5
def initialize(target)
@target = target
@dictionary = target.class.dictionary
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 14
def method_missing(name, *args, &block)
definition = @dictionary[name]
if definition
definition.call(@target, *args, &block)
else
p "Failed to find config #{name} in #{inspect}"
super
end
end
|
Instance Method Details
#inspect ⇒ Object
33
34
35
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 33
def inspect
"<DefinedObjectProxy #{@target} (#{@dictionary.keys})>"
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
24
25
26
27
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 24
def respond_to_missing?(name, include_private = false)
return true if @dictionary[name]
super
end
|
#to_s ⇒ Object
29
30
31
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 29
def to_s
inspect
end
|
#types ⇒ Object
10
11
12
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 10
def types
GraphQL::Define::TypeDefiner.instance
end
|