Class: Rose::Attribute::Indirect
- Inherits:
-
Rose::Attribute
- Object
- Rose::Attribute
- Rose::Attribute::Indirect
- Defined in:
- lib/rose/attribute.rb
Overview
This class defines an Attribute whose value is defined via a block
Instance Attribute Summary collapse
-
#value_block ⇒ Object
readonly
Returns the value of attribute value_block.
Attributes inherited from Rose::Attribute
Instance Method Summary collapse
- #evaluate(item) ⇒ Object
-
#initialize(method_name, column_name, value_block) ⇒ Indirect
constructor
A new instance of Indirect.
Constructor Details
#initialize(method_name, column_name, value_block) ⇒ Indirect
Returns a new instance of Indirect.
20 21 22 23 |
# File 'lib/rose/attribute.rb', line 20 def initialize(method_name, column_name, value_block) super(method_name, column_name) @value_block = value_block end |
Instance Attribute Details
#value_block ⇒ Object (readonly)
Returns the value of attribute value_block.
18 19 20 |
# File 'lib/rose/attribute.rb', line 18 def value_block @value_block end |
Instance Method Details
#evaluate(item) ⇒ Object
25 26 27 |
# File 'lib/rose/attribute.rb', line 25 def evaluate(item) item.instance_eval(&@value_block) end |