Class: FloorManager::Employee::AttributeAction::Base
- Inherits:
-
Object
- Object
- FloorManager::Employee::AttributeAction::Base
- Defined in:
- lib/floor_manager/employee/attribute_action.rb
Overview
Base class for stored actions.
Direct Known Subclasses
Instance Method Summary collapse
- #get(obj) ⇒ Object
-
#initialize(name) ⇒ Base
constructor
A new instance of Base.
- #set(obj, value) ⇒ Object
Constructor Details
#initialize(name) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/floor_manager/employee/attribute_action.rb', line 5 def initialize(name) @name = name end |
Instance Method Details
#get(obj) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/floor_manager/employee/attribute_action.rb', line 15 def get(obj) if obj.kind_of?(Hash) obj[@name] else obj.send(@name) end end |
#set(obj, value) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/floor_manager/employee/attribute_action.rb', line 8 def set(obj, value) if obj.kind_of?(Hash) obj[@name] = value else obj.send("#{@name}=", value) end end |