Class: ROM::Factory::Attributes::Callable Private
- Inherits:
-
Object
- Object
- ROM::Factory::Attributes::Callable
- Defined in:
- lib/rom/factory/attributes/callable.rb
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.
Instance Attribute Summary collapse
- #block ⇒ Object readonly private
- #dsl ⇒ Object readonly private
- #name ⇒ Object readonly private
Instance Method Summary collapse
- #call(attrs, *args) ⇒ Object private
- #dependency_names ⇒ Object private
-
#initialize(name, dsl = nil, &block) ⇒ Callable
constructor
private
A new instance of Callable.
- #value? ⇒ Boolean private
Constructor Details
#initialize(name, dsl = nil, &block) ⇒ Callable
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 Callable.
8 9 10 11 12 |
# File 'lib/rom/factory/attributes/callable.rb', line 8 def initialize(name, dsl = nil, &block) @name = name @dsl = dsl @block = block end |
Instance Attribute Details
#block ⇒ 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.
5 6 7 |
# File 'lib/rom/factory/attributes/callable.rb', line 5 def block @block end |
#dsl ⇒ 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.
5 6 7 |
# File 'lib/rom/factory/attributes/callable.rb', line 5 def dsl @dsl end |
#name ⇒ 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.
5 6 7 |
# File 'lib/rom/factory/attributes/callable.rb', line 5 def name @name end |
Instance Method Details
#call(attrs, *args) ⇒ 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.
15 16 17 18 19 |
# File 'lib/rom/factory/attributes/callable.rb', line 15 def call(attrs, *args) return if attrs.key?(name) result = dsl.instance_exec(*args, &block) { name => result } end |
#dependency_names ⇒ 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.
27 28 29 |
# File 'lib/rom/factory/attributes/callable.rb', line 27 def dependency_names block.parameters.map(&:last) end |
#value? ⇒ 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.
22 23 24 |
# File 'lib/rom/factory/attributes/callable.rb', line 22 def value? true end |