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, block) ⇒ Callable
constructor
private
A new instance of Callable.
- #value? ⇒ Boolean private
Constructor Details
#initialize(name, dsl, 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.
10 11 12 13 14 |
# File 'lib/rom/factory/attributes/callable.rb', line 10 def initialize(name, dsl, 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.
7 8 9 |
# File 'lib/rom/factory/attributes/callable.rb', line 7 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.
7 8 9 |
# File 'lib/rom/factory/attributes/callable.rb', line 7 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.
7 8 9 |
# File 'lib/rom/factory/attributes/callable.rb', line 7 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.
17 18 19 20 |
# File 'lib/rom/factory/attributes/callable.rb', line 17 def call(attrs, *args) result = attrs[name] || 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.
28 29 30 |
# File 'lib/rom/factory/attributes/callable.rb', line 28 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.
23 24 25 |
# File 'lib/rom/factory/attributes/callable.rb', line 23 def value? true end |