Module: ElasticGraph::GraphQL::Resolvers::ResolvableValue
- Defined in:
- lib/elastic_graph/graphql/resolvers/resolvable_value.rb
Overview
A class builder that is just like ‘Data` and also adapts itself to our resolver interface. Can resolve any field that is defined in `schema_element_names` and also has a corresponding method definition.
Class Method Summary collapse
-
.new(*fields, &block) ⇒ Object
‘MemoizableData.define` provides the following methods:.
Instance Method Summary collapse
Class Method Details
.new(*fields, &block) ⇒ Object
‘MemoizableData.define` provides the following methods:
22 23 24 25 26 27 28 29 |
# File 'lib/elastic_graph/graphql/resolvers/resolvable_value.rb', line 22 def self.new(*fields, &block) Support::MemoizableData.define(:schema, *fields) do # @implements ResolvableValueClass include ResolvableValue class_exec(&block) if block end end |
Instance Method Details
#resolve(field:, object:, context:, args:) ⇒ Object
31 32 33 34 |
# File 'lib/elastic_graph/graphql/resolvers/resolvable_value.rb', line 31 def resolve(field:, object:, context:, args:) method_name = canonical_name_for(field.name, "Field") public_send(method_name, **args_to_canonical_form(args)) end |