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.
55 56 57 58 59 |
# File 'lib/rom/plugins.rb', line 55 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.
52 53 54 |
# File 'lib/rom/plugins.rb', line 52 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.
52 53 54 |
# File 'lib/rom/plugins.rb', line 52 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.
52 53 54 |
# File 'lib/rom/plugins.rb', line 52 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.
62 63 64 |
# File 'lib/rom/plugins.rb', line 62 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.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/rom/plugins.rb', line 67 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.
86 87 88 |
# File 'lib/rom/plugins.rb', line 86 def key?(name) container.key?([_adapter, type, name].compact.join(".")) end |