module GraphQL
frozen_string_literal: true
Constants
- BOOLEAN_TYPE
- DEPRECATED_BOOLEAN_TYPE
- DEPRECATED_FLOAT_TYPE
- DEPRECATED_ID_TYPE
- DEPRECATED_INT_TYPE
Ruby has `deprecate_constant`, but I don't see a way to give a nice error message in that case, so I'm doing this instead.
- DEPRECATED_STRING_TYPE
- FLOAT_TYPE
- ID_TYPE
- INT_TYPE
- STRING_TYPE
- VERSION
Attributes
default_parser[W]
Public Class Methods
const_missing(const_name)
click to toggle source
Calls superclass method
# File lib/graphql.rb, line 167 def self.const_missing(const_name) deprecated_const_name = :"DEPRECATED_#{const_name}" if const_defined?(deprecated_const_name) deprecated_type = const_get(deprecated_const_name) deprecated_caller = caller(1, 1).first # Don't warn about internal uses, like `types.Int` if !deprecated_caller.include?("lib/graphql") warn "GraphQL::#{const_name} is deprecated and will be removed in GraphQL-Ruby 2.0, use GraphQL::Types::#{deprecated_type.graphql_name} instead. (from #{deprecated_caller})" end deprecated_type else super end end
default_parser()
click to toggle source
# File lib/graphql.rb, line 36 def default_parser @default_parser ||= GraphQL::Language::Parser end
parse(graphql_string, tracer: GraphQL::Tracing::NullTracer)
click to toggle source
Turn a query string or schema definition into an AST @param graphql_string [String] a GraphQL
query string or schema definition @return [GraphQL::Language::Nodes::Document]
# File lib/graphql.rb, line 46 def self.parse(graphql_string, tracer: GraphQL::Tracing::NullTracer) parse_with_racc(graphql_string, tracer: tracer) end
parse_file(filename)
click to toggle source
Read the contents of `filename` and parse them as GraphQL
@param filename [String] Path to a `.graphql` file containing IDL or query @return [GraphQL::Language::Nodes::Document]
# File lib/graphql.rb, line 53 def self.parse_file(filename) content = File.read(filename) parse_with_racc(content, filename: filename) end
parse_with_racc(string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
click to toggle source
# File lib/graphql.rb, line 58 def self.parse_with_racc(string, filename: nil, tracer: GraphQL::Tracing::NullTracer) GraphQL::Language::Parser.parse(string, filename: filename, tracer: tracer) end
scan(graphql_string)
click to toggle source
@return [Array<GraphQL::Language::Token>]
# File lib/graphql.rb, line 63 def self.scan(graphql_string) scan_with_ragel(graphql_string) end
scan_with_ragel(graphql_string)
click to toggle source
# File lib/graphql.rb, line 67 def self.scan_with_ragel(graphql_string) GraphQL::Language::Lexer.tokenize(graphql_string) end