Method: Workpattern::Clock#initialize
- Defined in:
- lib/workpattern/clock.rb
#initialize(hour = 0, min = 0) ⇒ Clock
Initialises an instance of Clock using the hours and minutes supplied or 0 if they are absent. Although there are 24 hours in a day (0-23) and 60 minutes in an hour (0-59), Clock calculates the full hours and remaining minutes of whatever is supplied.
30 31 32 33 |
# File 'lib/workpattern/clock.rb', line 30 def initialize(hour = 0, min = 0) @hour = total_minutes(hour, min).div(60) @min = total_minutes(hour, min) % 60 end |