Module: GraphQL
- Defined in:
- lib/graphql.rb,
lib/graphql/version.rb,
lib/graphql/language.rb,
lib/graphql/base_type.rb,
lib/graphql/scalar_type.rb,
lib/graphql/introspection.rb,
lib/graphql/query/context.rb,
lib/graphql/language/nodes.rb,
lib/graphql/query/executor.rb,
lib/graphql/schema/printer.rb,
lib/graphql/execution_error.rb,
lib/graphql/language/parser.rb,
lib/graphql/query/arguments.rb,
lib/graphql/query/variables.rb,
lib/graphql/schema/type_map.rb,
lib/graphql/language/visitor.rb,
lib/graphql/definition_helpers.rb,
lib/graphql/language/transform.rb,
lib/graphql/query/literal_input.rb,
lib/graphql/query/base_execution.rb,
lib/graphql/query/serial_execution.rb,
lib/graphql/schema/type_expression.rb,
lib/graphql/schema/middleware_chain.rb,
lib/graphql/schema/rescue_middleware.rb,
lib/graphql/query/base_execution/value_resolution.rb,
lib/graphql/query/serial_execution/field_resolution.rb,
lib/graphql/query/serial_execution/operation_resolution.rb,
lib/graphql/query/serial_execution/selection_resolution.rb
Defined Under Namespace
Modules: DefinitionHelpers, Introspection, Language, StaticValidation, TypeKinds Classes: Argument, BaseType, Directive, EnumType, ExecutionError, Field, InputObjectType, InterfaceType, ListType, NonNullType, ObjectType, ParseError, Query, Repl, ScalarType, Schema, UnionType
Constant Summary collapse
- ID_TYPE =
GraphQL::ScalarType.define do name "ID" coerce -> (value) { value.to_s } end
- VERSION =
"0.10.1"
- INT_TYPE =
GraphQL::ScalarType.define do name "Int" coerce -> (value) { value.is_a?(Numeric) ? value.to_i : nil } end
- TRANSFORM =
GraphQL::Language::Transform.new
- PARSER =
GraphQL::Language::Parser.new
- FLOAT_TYPE =
GraphQL::ScalarType.define do name "Float" coerce -> (value) do value.respond_to?(:to_f) ? value.to_f : nil end end
- STRING_TYPE =
GraphQL::ScalarType.define do name "String" coerce -> (value) { value.to_s } end
- BOOLEAN_TYPE =
GraphQL::ScalarType.define do name "Boolean" coerce -> (value) { !!value } end
Class Method Summary collapse
-
.parse(string, as: nil) ⇒ GraphQL::Language::Nodes::Document
Turn a query string into an AST.
Class Method Details
.parse(string, as: nil) ⇒ GraphQL::Language::Nodes::Document
Turn a query string into an AST
21 22 23 24 25 26 27 28 |
# File 'lib/graphql.rb', line 21 def self.parse(string, as: nil) parser = as ? GraphQL::PARSER.send(as) : GraphQL::PARSER tree = parser.parse(string) GraphQL::TRANSFORM.apply(tree) rescue Parslet::ParseFailed => error line, col = error.cause.source.line_and_column(error.cause.pos) raise GraphQL::ParseError.new(error., line, col, string) end |