lib/julia/action.rb in julia_builder-0.1.5 vs lib/julia/action.rb in julia_builder-0.2.0
- old
+ new
@@ -1,16 +1,16 @@
module Julia
class Action
attr_reader :key, :action, :block
def initialize(key, action = nil, &block)
- @key = key
@action = action
@block = block
+ @key = key
end
- def get_value(record)
- return block.call(record) if block
+ def get_value(record, host)
+ return host.instance_exec(record, &block) if block
return record.instance_exec(&action) if action.is_a? Proc
record.send [action, key].compact.first
end
end