Class: GraphQL::Schema::TypeReducer
- Inherits:
-
Object
- Object
- GraphQL::Schema::TypeReducer
- Defined in:
- lib/graphql/schema/type_reducer.rb
Overview
Starting from a given type, discover other types in the system by traversing that type’s fields, possible_types, etc
Instance Attribute Summary collapse
-
#existing_type_hash ⇒ Object
readonly
Returns the value of attribute existing_type_hash.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.find_all(types) ⇒ Object
Reduce all of ‘types` and return the combined result.
Instance Method Summary collapse
-
#initialize(type, existing_type_hash) ⇒ TypeReducer
constructor
A new instance of TypeReducer.
- #result ⇒ Object
Constructor Details
#initialize(type, existing_type_hash) ⇒ TypeReducer
Returns a new instance of TypeReducer.
6 7 8 9 10 11 12 13 14 |
# File 'lib/graphql/schema/type_reducer.rb', line 6 def initialize(type, existing_type_hash) validate_type(type) if type.respond_to?(:name) && existing_type_hash.fetch(type.name, nil).equal?(type) @result = existing_type_hash else @type = type end @existing_type_hash = existing_type_hash end |
Instance Attribute Details
#existing_type_hash ⇒ Object (readonly)
Returns the value of attribute existing_type_hash.
4 5 6 |
# File 'lib/graphql/schema/type_reducer.rb', line 4 def existing_type_hash @existing_type_hash end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/graphql/schema/type_reducer.rb', line 4 def type @type end |
Class Method Details
Instance Method Details
#result ⇒ Object
16 17 18 |
# File 'lib/graphql/schema/type_reducer.rb', line 16 def result @result ||= find_types(type, existing_type_hash) end |