Class: FloorManager::Employee::Unique
- Defined in:
- lib/floor_manager/employee.rb
Overview
A unique employee that will be build/created only once in the given floor.
Instance Method Summary collapse
- #attrs(floor, overrides) ⇒ Object
-
#build(floor, overrides) ⇒ Object
Override these to shortcut attribute setting when the instance exists already.
- #create(floor, overrides) ⇒ Object
- #reset ⇒ Object
Methods inherited from Template
#add_attribute, #apply_attributes, #camelcase, from_dsl, #initialize
Constructor Details
This class inherits a constructor from FloorManager::Employee::Template
Instance Method Details
#attrs(floor, overrides) ⇒ Object
98 99 100 |
# File 'lib/floor_manager/employee.rb', line 98 def attrs(floor, overrides) @instance && @instance.attributes || super end |
#build(floor, overrides) ⇒ Object
Override these to shortcut attribute setting when the instance exists already.
92 93 94 |
# File 'lib/floor_manager/employee.rb', line 92 def build(floor, overrides) @instance || super end |
#create(floor, overrides) ⇒ Object
95 96 97 |
# File 'lib/floor_manager/employee.rb', line 95 def create(floor, overrides) @instance || super end |
#reset ⇒ Object
86 87 88 |
# File 'lib/floor_manager/employee.rb', line 86 def reset @instance = nil end |