Class: GraphQL::Language::Transform
- Inherits:
-
Parslet::Transform
- Object
- Parslet::Transform
- GraphQL::Language::Transform
- Defined in:
- lib/graphql/language/transform.rb
Overview
Transform is a [parslet](kschiess.github.io/parslet/) transform for for turning the AST into objects in Nodes objects.
Constant Summary collapse
- CREATE_NODE =
Returns a node of type ‘name` with attributes `attributes`.
Proc.new do |name, attributes| node_class = GraphQL::Language::Nodes.const_get(name) node_class.new(attributes) end
- ESCAPES =
/\\["\\\/bfnrt]/- ESCAPES_REPLACE =
{ '\\"' => '"', "\\\\" => "\\", "\\/" => '/', "\\b" => "\b", "\\f" => "\f", "\\n" => "\n", "\\r" => "\r", "\\t" => "\t" }
- UTF_8 =
/\\u[\da-f]{4}/i- UTF_8_REPLACE =
-> (m) { [m[-4..-1].to_i(16)].pack('U') }
Class Method Summary collapse
Class Method Details
.optional_sequence(name) ⇒ Object
14 15 16 17 |
# File 'lib/graphql/language/transform.rb', line 14 def self.optional_sequence(name) rule(name => simple(:val)) { [] } rule(name => sequence(:val)) { val } end |