Class: KrkTimetables::Departure

Inherits:
Object
  • Object
show all
Defined in:
lib/krk-timetables_departure.rb

Instance Method Summary collapse

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

#timeObject



7
8
9
# File 'lib/krk-timetables_departure.rb', line 7

def time
  "#{@hour_part}:#{@minute_part.to_s.rjust(2, "0")}"
end

#time_todayObject



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