Class: GraphQL::Client::QueryResult::Scalar
- Inherits:
-
Object
- Object
- GraphQL::Client::QueryResult::Scalar
- Defined in:
- lib/graphql/client/query_result.rb
Overview
:nodoc:
Instance Method Summary collapse
- #cast(value, _errors = nil) ⇒ Object
-
#initialize(type) ⇒ Scalar
constructor
A new instance of Scalar.
- #|(_other) ⇒ Object
Constructor Details
permalink #initialize(type) ⇒ Scalar
Returns a new instance of Scalar.
51 52 53 |
# File 'lib/graphql/client/query_result.rb', line 51 def initialize(type) @type = type end |
Instance Method Details
permalink #cast(value, _errors = nil) ⇒ Object
[View source]
55 56 57 58 59 60 61 |
# File 'lib/graphql/client/query_result.rb', line 55 def cast(value, _errors = nil) if value.is_a? Array value.map { |item| @type.coerce_input(item) } else @type.coerce_input(value) end end |
permalink #|(_other) ⇒ Object
[View source]
63 64 65 66 |
# File 'lib/graphql/client/query_result.rb', line 63 def |(_other) # XXX: How would scalars merge? self end |