Class: FloorManager::Employee::AttributeAction::AssocAppend

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

Overview

Stores the action of producing another employee via a collection proxy stored in field.

Instance Method Summary collapse

Methods inherited from Base

#get, #set

Constructor Details

#initialize(field, create_args) ⇒ AssocAppend

Returns a new instance of AssocAppend.



27
28
29
30
# File 'lib/floor_manager/employee/attribute_action.rb', line 27

def initialize(field, create_args)
  super field
  @create_args = create_args
end

Instance Method Details

#apply(obj, floor, employee) ⇒ Object



31
32
33
34
# File 'lib/floor_manager/employee/attribute_action.rb', line 31

def apply(obj, floor, employee)
  instance = floor.build(*@create_args)
  get(obj) << instance
end