Class: Yogurt::CodeGenerator::FieldAccessPath
- Inherits:
-
T::Struct
- Object
- T::Struct
- Yogurt::CodeGenerator::FieldAccessPath
show all
- Extended by:
- T::Sig, Utils
- Includes:
- Utils, Memoize
- Defined in:
- lib/yogurt/code_generator/field_access_path.rb
Instance Method Summary
collapse
Methods included from Utils
camelize, generate_method_name, generate_pretty_print, indent, possible_types_constant, typename_method, underscore
Methods included from Memoize
#memoize_as
Instance Method Details
#compatible_object_types ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/yogurt/code_generator/field_access_path.rb', line 41
def compatible_object_types
memoize_as(:compatible_object_types) do
result = schema.possible_types(schema.types[fragment_types.fetch(0)]).to_set
if fragment_types.size > 1
T.must(fragment_types[1..-1]).each do |next_type|
result = result.intersection(schema.possible_types(schema.types[next_type]))
end
end
result.map(&:graphql_name).to_set.freeze
end
end
|
#freeze ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/yogurt/code_generator/field_access_path.rb', line 28
def freeze
compatible_object_types
fragment_types.each(&:freeze)
fragment_types.freeze
expression.freeze
signature.freeze
super
self
end
|