Class: PunchTime::Configuration
- Inherits:
-
Object
- Object
- PunchTime::Configuration
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/punch_time/configuration.rb
Instance Attribute Summary collapse
-
#breaks ⇒ Object
Returns the value of attribute breaks.
-
#night ⇒ Object
Returns the value of attribute night.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#shift_in_time ⇒ Object
Returns the value of attribute shift_in_time.
-
#shift_out_time ⇒ Object
Returns the value of attribute shift_out_time.
Instance Method Summary collapse
-
#initialize {|raw| ... } ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize {|raw| ... } ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/punch_time/configuration.rb', line 23 def initialize self.raw = Raw.new yield raw if block_given? self.shift_in_time ||= raw.shift_in_time self.shift_out_time ||= raw.shift_out_time self.night ||= raw.night self.breaks ||= raw.breaks self.offset ||= raw.offset raise ArgumentError, errors. unless valid? raw.freeze end |
Instance Attribute Details
#breaks ⇒ Object
Returns the value of attribute breaks.
15 16 17 |
# File 'lib/punch_time/configuration.rb', line 15 def breaks @breaks end |
#night ⇒ Object
Returns the value of attribute night.
14 15 16 |
# File 'lib/punch_time/configuration.rb', line 14 def night @night end |
#offset ⇒ Object
Returns the value of attribute offset.
16 17 18 |
# File 'lib/punch_time/configuration.rb', line 16 def offset @offset end |
#raw ⇒ Object
Returns the value of attribute raw.
11 12 13 |
# File 'lib/punch_time/configuration.rb', line 11 def raw @raw end |
#shift_in_time ⇒ Object
Returns the value of attribute shift_in_time.
12 13 14 |
# File 'lib/punch_time/configuration.rb', line 12 def shift_in_time @shift_in_time end |
#shift_out_time ⇒ Object
Returns the value of attribute shift_out_time.
13 14 15 |
# File 'lib/punch_time/configuration.rb', line 13 def shift_out_time @shift_out_time end |