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
msg = "#{@target.class.name} can't define '#{name}'"
raise NoMethodError, msg, caller
end
end
|
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
24
25
26
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 24
def respond_to_missing?(name, include_private = false)
@dictionary[name] || super
end
|
#types ⇒ Object
10
11
12
|
# File 'lib/graphql/define/defined_object_proxy.rb', line 10
def types
GraphQL::Define::TypeDefiner.instance
end
|