Class: Rails::GraphQL::Request::Strategy::DynamicInstance
- Inherits:
-
Helpers::AttributeDelegator
- Object
- Helpers::AttributeDelegator
- Rails::GraphQL::Request::Strategy::DynamicInstance
- Defined in:
- lib/rails/graphql/request/strategy/dynamic_instance.rb
Overview
GraphQl Strategy Dynamic Instance
When an event is call on non-object types, this class allows both finding a method on two different places, the interface or union definition, or on the currect object type-class.
Instance Method Summary collapse
Methods inherited from Helpers::AttributeDelegator
Constructor Details
This class inherits a constructor from Rails::GraphQL::Helpers::AttributeDelegator
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **xargs, &block) ⇒ Object (private)
23 24 25 26 27 28 |
# File 'lib/rails/graphql/request/strategy/dynamic_instance.rb', line 23 def method_missing(method_name, *args, **xargs, &block) object = __current_object__ return super unless object&.respond_to?(method_name) object.public_send(method_name, *args, **xargs, &block) end |
Instance Method Details
#instance_variable_set(ivar, value) ⇒ Object
12 13 14 15 |
# File 'lib/rails/graphql/request/strategy/dynamic_instance.rb', line 12 def instance_variable_set(ivar, value) __getobj__.instance_variable_set(ivar, value) __current_object__&.instance_variable_set(ivar, value) end |