Class: Rails::GraphQL::Source::ScopedConfig
- Inherits:
-
Struct
- Object
- Struct
- Rails::GraphQL::Source::ScopedConfig
- Defined in:
- lib/rails/graphql/source.rb
Overview
Helper class to be used as the self
in configuration blocks
Instance Attribute Summary collapse
-
#receiver ⇒ Object
Returns the value of attribute receiver.
-
#self_object ⇒ Object
Returns the value of attribute self_object.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #method_missing(method_name, *args, **xargs, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #safe_field(name, *args, **xargs, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **xargs, &block) ⇒ Object
40 41 42 43 44 |
# File 'lib/rails/graphql/source.rb', line 40 def method_missing(method_name, *args, **xargs, &block) self_object.respond_to?(method_name, true) \ ? self_object.send(method_name, *args, **xargs, &block) \ : receiver.send(method_name, *args, **xargs, &block) end |
Instance Attribute Details
#receiver ⇒ Object
Returns the value of attribute receiver
29 30 31 |
# File 'lib/rails/graphql/source.rb', line 29 def receiver @receiver end |
#self_object ⇒ Object
Returns the value of attribute self_object
29 30 31 |
# File 'lib/rails/graphql/source.rb', line 29 def self_object @self_object end |
#type ⇒ Object
Returns the value of attribute type
29 30 31 |
# File 'lib/rails/graphql/source.rb', line 29 def type @type end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
35 36 37 38 |
# File 'lib/rails/graphql/source.rb', line 35 def respond_to_missing?(method_name, include_private = false) self_object.respond_to?(method_name, include_private) || receiver.respond_to?(method_name, include_private) end |
#safe_field(name, *args, **xargs, &block) ⇒ Object
30 31 32 33 |
# File 'lib/rails/graphql/source.rb', line 30 def safe_field(name, *args, **xargs, &block) return if receiver.send(:skip_field?, name, on: type) self_object.safe_field(name, *args, **xargs, &block) end |