Class: GraphQL::Query::RubyInput

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/query/ruby_input.rb

Overview

Turn Ruby values into something useful for query execution

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, incoming_value) ⇒ RubyInput

Returns a new instance of RubyInput.



5
6
7
8
# File 'lib/graphql/query/ruby_input.rb', line 5

def initialize(type, incoming_value)
  @type = type
  @incoming_value = incoming_value
end

Class Method Details

.coerce(type, value) ⇒ Object



14
15
16
17
# File 'lib/graphql/query/ruby_input.rb', line 14

def self.coerce(type, value)
  input = self.new(type, value)
  input.graphql_value
end

Instance Method Details

#graphql_valueObject



10
11
12
# File 'lib/graphql/query/ruby_input.rb', line 10

def graphql_value
  @type.coerce_input!(@incoming_value)
end