class GraphQL::Language::Nodes::FieldDefinition
Attributes
directives
[R]
Array[Directive]
fields
[R]
Array[InputValueDefinition]
Public Class Methods
# File lib/graphql/language/nodes.rb, line 1585 def self.from_a(filename, line, col, name, type, description, arguments, directives, comment: nil) # rubocop:disable Metrics/ParameterLists self.new(filename: filename, line: line, col: col, name: name, type: type, description: description, comment: comment, arguments: arguments, directives: directives) end
(?name: untyped, ?type: untyped, ?description: untyped, ?comment: untyped, ?arguments: Array[InputValueDefinition], ?directives: Array[Directive], ?line: Integer?, ?col: Integer?, ?pos: Integer?, ?filename: String?, ?source: untyped, ?definition_pos: Integer?) → void
Source
# File lib/graphql/language/nodes.rb, line 1570 def initialize(name: nil, type: nil, description: nil, comment: nil, arguments: NO_CHILDREN, directives: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil, definition_pos: nil) @line = line @col = col @pos = pos @filename = filename @source = source @name = name @type = type @description = description && -description @comment = comment @arguments = arguments.freeze @directives = directives.freeze @definition_pos = definition_pos end
Public Instance Methods
Source
# File lib/graphql/language/nodes.rb, line 1555 def children @children ||= begin if !@arguments.empty? || !@directives.empty? new_children = [] new_children.concat(@arguments) new_children.concat(@directives) new_children.freeze new_children else NO_CHILDREN end end end
Source
# File lib/graphql/language/nodes.rb, line 1589 def marshal_dump [ line, col, # use methods here to force them to be calculated @filename, @name, @type, @description, @arguments, @directives, ] end
Source
# File lib/graphql/language/nodes.rb, line 1601 def marshal_load(values) @line, @col, @filename, @name, @type, @description, @arguments, @directives = values end
Source
# File lib/graphql/language/nodes.rb, line 1614 def merge(new_options) if (f = new_options.delete(:fields)) new_options[:arguments] = f end super end
Calls superclass method
GraphQL::Language::Nodes::AbstractNode#merge
Source
# File lib/graphql/language/nodes.rb, line 1547 def merge_argument(**node_opts) merge(arguments: arguments + [GraphQL::Language::Nodes::InputValueDefinition.new(**node_opts)]) end
# File lib/graphql/language/nodes.rb, line 1551 def merge_directive(**node_opts) merge(directives: directives + [GraphQL::Language::Nodes::Directive.new(**node_opts)]) end
Source
# File lib/graphql/language/nodes.rb, line 1538 def scalars @scalars ||= [@name, @type].freeze end
Source
# File lib/graphql/language/nodes.rb, line 1525 def visit_method :on_field_definition end