class Array
Public Instance Methods
arrivals()
click to toggle source
# File lib/alohaha/flight_helper.rb, line 2 def arrivals self.select {|flights| flights.kind == 'Arrivals' } end
by_datetime(datetime = DateTime.now)
click to toggle source
# File lib/alohaha/flight_helper.rb, line 22 def by_datetime(datetime = DateTime.now) self.select {|flights| flights.datetime > datetime } end
departure()
click to toggle source
# File lib/alohaha/flight_helper.rb, line 6 def departure self.select {|flights| flights.kind == 'Departure' } end
filter_kind()
click to toggle source
# File lib/alohaha/flight_helper.rb, line 26 def filter_kind { Arrivals: self.select {|flights| flights.kind == 'Arrivals'}, Departure: self.select {|flights| flights.kind == 'Departure'} } end
today()
click to toggle source
# File lib/alohaha/flight_helper.rb, line 14 def today self.select {|flights| flights.datetime.to_time >= Date.today.to_time && flights.datetime.to_time <= Date.today.next_day.to_time } end
tomorrow()
click to toggle source
# File lib/alohaha/flight_helper.rb, line 18 def tomorrow self.select {|flights| flights.datetime.to_time >= Date.today.next_day.to_time } end
yesterday()
click to toggle source
# File lib/alohaha/flight_helper.rb, line 10 def yesterday self.select {|flights| flights.datetime.to_time >= Date.today.prev_day.to_time && flights.datetime.to_time <= Date.today.to_time } end