Class: GraphQL::Execution::Lazy::LazyMethodMap Private
- Inherits:
-
Object
- Object
- GraphQL::Execution::Lazy::LazyMethodMap
- Defined in:
- lib/graphql/execution/lazy/lazy_method_map.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Schema uses this to match returned values to lazy resolution methods. Methods may be registered for classes, they apply to its subclasses also. The result of this lookup is cached for future resolutions.
Instance Method Summary collapse
- #each ⇒ Object private
-
#get(value) ⇒ Symbol?
private
The
lazy_value_methodfor this object, or nil. -
#initialize ⇒ LazyMethodMap
constructor
private
A new instance of LazyMethodMap.
- #set(lazy_class, lazy_value_method) ⇒ Object private
Constructor Details
#initialize ⇒ LazyMethodMap
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of LazyMethodMap.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/graphql/execution/lazy/lazy_method_map.rb', line 11 def initialize @storage = Hash.new do |h, value_class| registered_superclass = h.each_key.find { |lazy_class| value_class < lazy_class } if registered_superclass.nil? h[value_class] = nil else h[value_class] = h[registered_superclass] end end end |
Instance Method Details
#each ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/graphql/execution/lazy/lazy_method_map.rb', line 34 def each @storage.each { |k, v| yield(k,v) } end |
#get(value) ⇒ Symbol?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The lazy_value_method for this object, or nil.
30 31 32 |
# File 'lib/graphql/execution/lazy/lazy_method_map.rb', line 30 def get(value) @storage[value.class] end |
#set(lazy_class, lazy_value_method) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/graphql/execution/lazy/lazy_method_map.rb', line 24 def set(lazy_class, lazy_value_method) @storage[lazy_class] = lazy_value_method end |