Class: KrkTimetables::Departure
- Inherits:
-
Object
- Object
- KrkTimetables::Departure
- Defined in:
- lib/krk-timetables_departure.rb
Instance Method Summary collapse
-
#initialize(hour_part, minute_part) ⇒ Departure
constructor
A new instance of Departure.
- #time ⇒ Object
- #time_today ⇒ Object
Constructor Details
#initialize(hour_part, minute_part) ⇒ Departure
Returns a new instance of Departure.
3 4 5 |
# File 'lib/krk-timetables_departure.rb', line 3 def initialize(hour_part, minute_part) @hour_part, @minute_part = hour_part, minute_part end |
Instance Method Details
#time ⇒ Object
7 8 9 |
# File 'lib/krk-timetables_departure.rb', line 7 def time "#{@hour_part}:#{@minute_part.to_s.rjust(2, "0")}" end |
#time_today ⇒ Object
11 12 13 14 15 |
# File 'lib/krk-timetables_departure.rb', line 11 def time_today now = Time.now Time.new(now.year, now.month, now.day, @hour_part, @minute_part) end |