Class: FloorManager::Employee::AttributeAction::Block

Inherits:
Base
  • Object
show all
Defined in:
lib/floor_manager/employee/attribute_action.rb

Overview

Stores the action of setting an attribute to the result of a block.

Instance Method Summary collapse

Methods inherited from Base

#get, #set

Constructor Details

#initialize(name, block) ⇒ Block

Returns a new instance of Block.



63
64
65
66
# File 'lib/floor_manager/employee/attribute_action.rb', line 63

def initialize(name, block)
  super(name)
  @block = block
end

Instance Method Details

#apply(obj, floor, employee) ⇒ Object



67
68
69
# File 'lib/floor_manager/employee/attribute_action.rb', line 67

def apply(obj, floor, employee)
  set(obj, @block.call(obj, floor))
end