Class: Rose::Attribute::Indirect

Inherits:
Rose::Attribute show all
Defined in:
lib/rose/attribute.rb

Overview

This class defines an Attribute whose value is defined via a block

Direct Known Subclasses

Filter, Pivot

Instance Attribute Summary collapse

Attributes inherited from Rose::Attribute

#column_name, #method_name

Instance Method Summary collapse

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_blockObject (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