Class: Objectify::MultiResolverLocator
- Inherits:
-
Object
- Object
- Objectify::MultiResolverLocator
- Defined in:
- lib/objectify/resolver_locator.rb
Instance Method Summary collapse
- #call(name) ⇒ Object
- #clear_context ⇒ Object
- #context(context) ⇒ Object
-
#initialize(locators) ⇒ MultiResolverLocator
constructor
A new instance of MultiResolverLocator.
Constructor Details
#initialize(locators) ⇒ MultiResolverLocator
Returns a new instance of MultiResolverLocator.
15 16 17 |
# File 'lib/objectify/resolver_locator.rb', line 15 def initialize(locators) @locators = [*locators] end |
Instance Method Details
#call(name) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/objectify/resolver_locator.rb', line 19 def call(name) @locators.each do |locator| resolver = locator.call(name) return resolver if resolver end raise ArgumentError, "No resolver found for #{name}." end |
#clear_context ⇒ Object
32 33 34 |
# File 'lib/objectify/resolver_locator.rb', line 32 def clear_context @locators.shift end |
#context(context) ⇒ Object
28 29 30 |
# File 'lib/objectify/resolver_locator.rb', line 28 def context(context) @locators.unshift(context) end |