Method: GraphQL::Language::Parser#initialize

Defined in:
lib/graphql/language/parser.rb

#initialize(graphql_str, filename: nil, trace: Tracing::NullTrace) ⇒ Parser

Returns a new instance of Parser.



30
31
32
33
34
35
36
37
38
# File 'lib/graphql/language/parser.rb', line 30

def initialize(graphql_str, filename: nil, trace: Tracing::NullTrace)
  if graphql_str.nil?
    raise GraphQL::ParseError.new("No query string was present", nil, nil, nil)
  end
  @lexer = Lexer.new(graphql_str, filename: filename)
  @graphql_str = graphql_str
  @filename = filename
  @trace = trace
end