Class: GQL::Fields::Array
- Inherits:
-
GQL::Field
- Object
- Node
- GQL::Field
- GQL::Fields::Array
- Defined in:
- lib/gql/fields/array.rb
Instance Attribute Summary
Attributes inherited from Node
#ast_node, #context, #target, #variables
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Node
call, cursor, field, #initialize, method_missing, #value_of_call, #value_of_field, #value_of_fields
Constructor Details
This class inherits a constructor from GQL::Node
Class Method Details
.build_class(method, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gql/fields/array.rb', line 9 def build_class(method, = {}) node_class = [:node_class] || self.node_class if node_class.nil? raise Errors::UndefinedNodeClass.new(self, 'node') end unless node_class <= GQL::Node raise Errors::InvalidNodeClass.new(node_class, GQL::Node) end Class.new(self).tap do |field_class| field_class.method = method field_class.node_class = node_class end end |
Instance Method Details
#raw_value ⇒ Object
34 35 36 |
# File 'lib/gql/fields/array.rb', line 34 def raw_value nil end |
#value ⇒ Object
27 28 29 30 31 32 |
# File 'lib/gql/fields/array.rb', line 27 def value target.map do |item| node = self.class.node_class.new(ast_node, item, variables, context) node.value end end |