Class: ROM::Plugins::Resolver Private
- Inherits:
-
Object
- Object
- ROM::Plugins::Resolver
- Defined in:
- lib/rom/plugins.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.
TODO: move to rom/compat
Instance Attribute Summary collapse
- #_adapter ⇒ Object readonly private
- #container ⇒ Object readonly private
- #type ⇒ Object readonly private
Instance Method Summary collapse
- #adapter(name) ⇒ Object private
- #fetch(name, adapter = nil) ⇒ Object (also: #[]) private
-
#initialize(container, type:, adapter: nil) ⇒ Resolver
constructor
private
A new instance of Resolver.
- #key?(name) ⇒ Boolean private
Constructor Details
#initialize(container, type:, adapter: nil) ⇒ Resolver
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 Resolver.
53 54 55 56 57 |
# File 'lib/rom/plugins.rb', line 53 def initialize(container, type:, adapter: nil) @container = container @type = type @_adapter = adapter end |
Instance Attribute Details
#_adapter ⇒ Object (readonly)
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.
50 51 52 |
# File 'lib/rom/plugins.rb', line 50 def _adapter @_adapter end |
#container ⇒ Object (readonly)
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.
50 51 52 |
# File 'lib/rom/plugins.rb', line 50 def container @container end |
#type ⇒ Object (readonly)
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.
50 51 52 |
# File 'lib/rom/plugins.rb', line 50 def type @type end |
Instance Method Details
#adapter(name) ⇒ 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.
60 61 62 |
# File 'lib/rom/plugins.rb', line 60 def adapter(name) self.class.new(container, type: type, adapter: name) end |
#fetch(name, adapter = nil) ⇒ Object Also known as: []
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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rom/plugins.rb', line 65 def fetch(name, adapter = nil) if adapter key = [adapter, type, name].compact.join(".") if container.key?(key) container.resolve(key) else fetch(name) end elsif _adapter && key?(name) fetch(name, _adapter) else key = "#{type}.#{name}" container.resolve(key) end end |
#key?(name) ⇒ Boolean
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.
84 85 86 |
# File 'lib/rom/plugins.rb', line 84 def key?(name) container.key?([_adapter, type, name].compact.join(".")) end |