Class: GraphQL::Client::QueryResult::NonNullWrapper
- Inherits:
-
Object
- Object
- GraphQL::Client::QueryResult::NonNullWrapper
- Defined in:
- lib/graphql/client/query_result.rb
Instance Attribute Summary collapse
-
#of_klass ⇒ Object
readonly
Returns the value of attribute of_klass.
Instance Method Summary collapse
- #cast(value, errors) ⇒ Object
-
#initialize(type) ⇒ NonNullWrapper
constructor
A new instance of NonNullWrapper.
- #|(other) ⇒ Object
Constructor Details
#initialize(type) ⇒ NonNullWrapper
Returns a new instance of NonNullWrapper.
127 128 129 |
# File 'lib/graphql/client/query_result.rb', line 127 def initialize(type) @of_klass = type end |
Instance Attribute Details
#of_klass ⇒ Object (readonly)
Returns the value of attribute of_klass.
125 126 127 |
# File 'lib/graphql/client/query_result.rb', line 125 def of_klass @of_klass end |
Instance Method Details
#cast(value, errors) ⇒ Object
131 132 133 134 135 136 137 138 139 140 |
# File 'lib/graphql/client/query_result.rb', line 131 def cast(value, errors) case value when NilClass # TODO # raise ArgumentError, "expected non-nullable value to be present" nil else @of_klass.cast(value, errors) end end |
#|(other) ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/graphql/client/query_result.rb', line 142 def |(other) if self.class == other.class self.of_klass | other.of_klass else raise TypeError, "expected other to be a #{self.class}" end end |