class GraphQL::Language::Nodes::DirectiveDefinition
Attributes
locations
[R]
Array[DirectiveLocation]
repeatable
[R]
bool
Public Class Methods
Source
# File lib/graphql/language/nodes.rb, line 489 def self.from_a(filename, line, col, name, repeatable, description, arguments, locations, comment: nil) # rubocop:disable Metrics/ParameterLists self.new(filename: filename, line: line, col: col, name: name, repeatable: repeatable, description: description, arguments: arguments, locations: locations) end
(?name: untyped, ?repeatable: untyped, ?description: untyped, ?arguments: Array[InputValueDefinition], ?locations: Array[DirectiveLocation], ?line: Integer?, ?col: Integer?, ?pos: Integer?, ?filename: String?, ?source: untyped, ?definition_pos: Integer?) → void
Source
# File lib/graphql/language/nodes.rb, line 475 def initialize(name: nil, repeatable: nil, description: nil, arguments: NO_CHILDREN, locations: 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 @repeatable = repeatable @description = description && -description @arguments = arguments.freeze @locations = locations.freeze @definition_pos = definition_pos end
Public Instance Methods
Source
# File lib/graphql/language/nodes.rb, line 460 def children @children ||= begin if !@arguments.empty? || !@locations.empty? new_children = [] new_children.concat(@arguments) new_children.concat(@locations) new_children.freeze new_children else NO_CHILDREN end end end
Source
# File lib/graphql/language/nodes.rb, line 493 def marshal_dump [ line, col, # use methods here to force them to be calculated @filename, @name, @repeatable, @description, @arguments, @locations, ] end
Source
# File lib/graphql/language/nodes.rb, line 505 def marshal_load(values) @line, @col, @filename, @name, @repeatable, @description, @arguments, @locations = values end
Source
# File lib/graphql/language/nodes.rb, line 452 def merge_argument(**node_opts) merge(arguments: arguments + [GraphQL::Language::Nodes::Argument.new(**node_opts)]) end
Source
# File lib/graphql/language/nodes.rb, line 456 def merge_location(**node_opts) merge(locations: locations + [GraphQL::Language::Nodes::DirectiveLocation.new(**node_opts)]) end
Source
# File lib/graphql/language/nodes.rb, line 443 def scalars @scalars ||= [@name, @repeatable].freeze end
Source
# File lib/graphql/language/nodes.rb, line 432 def visit_method :on_directive_definition end