Class: GraphQL::Client::Schema::IncludeDirective
- Inherits:
-
Object
- Object
- GraphQL::Client::Schema::IncludeDirective
- Includes:
- BaseType
- Defined in:
- lib/graphql/client/schema/include_directive.rb
Instance Attribute Summary collapse
-
#of_klass ⇒ Object
readonly
Internal: Get wrapped klass.
Attributes included from BaseType
Instance Method Summary collapse
-
#cast(value, errors) ⇒ Object
Internal: Cast JSON value to wrapped value.
-
#initialize(of_klass) ⇒ IncludeDirective
constructor
Internal: Construct list wrapper from other BaseType.
Methods included from BaseType
#to_list_type, #to_non_null_type
Constructor Details
#initialize(of_klass) ⇒ IncludeDirective
Internal: Construct list wrapper from other BaseType.
of_klass - BaseType instance
14 15 16 17 18 19 20 |
# File 'lib/graphql/client/schema/include_directive.rb', line 14 def initialize(of_klass) unless of_klass.is_a?(BaseType) raise TypeError, "expected #{of_klass.inspect} to be a #{BaseType}" end @of_klass = of_klass end |
Instance Attribute Details
#of_klass ⇒ Object (readonly)
Internal: Get wrapped klass.
Returns BaseType instance.
25 26 27 |
# File 'lib/graphql/client/schema/include_directive.rb', line 25 def of_klass @of_klass end |
Instance Method Details
#cast(value, errors) ⇒ Object
Internal: Cast JSON value to wrapped value.
values - JSON value errors - Errors instance
Returns List instance or nil.
33 34 35 36 37 38 39 40 |
# File 'lib/graphql/client/schema/include_directive.rb', line 33 def cast(value, errors) case value when NilClass nil else of_klass.cast(value, errors) end end |