Class: Kounta::Shift
- Defined in:
- lib/kounta/shift.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Shift
constructor
A new instance of Shift.
- #to_hash ⇒ Object
Methods inherited from Resource
coerce, #delete!, has_many, has_many_in_time_range, has_one, #ignored_properties, #new?, #save!
Constructor Details
#initialize(hash = {}) ⇒ Shift
Returns a new instance of Shift.
14 15 16 17 |
# File 'lib/kounta/shift.rb', line 14 def initialize(hash = {}) super(hash) self.breaks ||= [] end |
Instance Method Details
#to_hash ⇒ Object
19 20 21 22 23 |
# File 'lib/kounta/shift.rb', line 19 def to_hash returning = {} returning[:breaks] = breaks.map(&:to_hash) if breaks && !breaks.empty? super(returning) end |