Class: GraphQL::Language::Nodes::InputObject
- Inherits:
-
AbstractNode
- Object
- AbstractNode
- GraphQL::Language::Nodes::InputObject
- Defined in:
- lib/graphql/language/nodes.rb
Overview
A collection of key-value inputs which may be a field argument
Constant Summary
Constants inherited from AbstractNode
Instance Attribute Summary collapse
-
#arguments ⇒ Object
(also: #children)
readonly
Returns.
Attributes inherited from AbstractNode
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(arguments: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil) ⇒ InputObject
constructor
: (?arguments: Array, ?line: Integer?, ?col: Integer?, ?pos: Integer?, ?filename: String?, ?source: untyped) -> void.
- #marshal_dump ⇒ Object
- #marshal_load(values) ⇒ Object
- #merge_argument(**node_opts) ⇒ Object
-
#to_h(options = {}) ⇒ Object
Returns.
- #visit_method ⇒ Object
Methods inherited from AbstractNode
#==, #children_method_name, children_of_type, #col, #definition_line, #delete_child, inherited, #initialize_copy, #line, #merge, #position, #replace_child, #scalars, #to_query_string
Constructor Details
#initialize(arguments: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil) ⇒ InputObject
: (?arguments: Array, ?line: Integer?, ?col: Integer?, ?pos: Integer?, ?filename: String?, ?source: untyped) -> void
852 853 854 855 856 857 858 859 |
# File 'lib/graphql/language/nodes.rb', line 852 def initialize(arguments: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil) @line = line @col = col @pos = pos @filename = filename @source = source @arguments = arguments.freeze end |
Instance Attribute Details
#arguments ⇒ Object (readonly) Also known as: children
Returns
Array<Nodes::Argument>— A list of key-value pairs inside this input object : Array
843 844 845 |
# File 'lib/graphql/language/nodes.rb', line 843 def arguments @arguments end |
Class Method Details
.from_a(filename, line, col, arguments, comment: nil) ⇒ Object
861 862 863 |
# File 'lib/graphql/language/nodes.rb', line 861 def self.from_a(filename, line, col, arguments, comment: nil) self.new(filename: filename, line: line, col: col, arguments: arguments) end |
Instance Method Details
#marshal_dump ⇒ Object
865 866 867 868 869 870 871 |
# File 'lib/graphql/language/nodes.rb', line 865 def marshal_dump [ line, col, # use methods here to force them to be calculated @filename, @arguments, ] end |
#marshal_load(values) ⇒ Object
873 874 875 |
# File 'lib/graphql/language/nodes.rb', line 873 def marshal_load(values) @line, @col, @filename, @arguments = values end |
#merge_argument(**node_opts) ⇒ Object
845 846 847 |
# File 'lib/graphql/language/nodes.rb', line 845 def merge_argument(**node_opts) merge(arguments: arguments + [GraphQL::Language::Nodes::Argument.new(**node_opts)]) end |
#to_h(options = {}) ⇒ Object
Returns
Hash<String, Any>— Recursively turn this input object into a Ruby Hash
:call-seq:
to_h(options=) -> Hash[String, Any]
887 888 889 890 891 892 893 |
# File 'lib/graphql/language/nodes.rb', line 887 def to_h(={}) arguments.inject({}) do |memo, pair| v = pair.value memo[pair.name] = serialize_value_for_hash v memo end end |
#visit_method ⇒ Object
835 836 837 |
# File 'lib/graphql/language/nodes.rb', line 835 def visit_method :on_input_object end |