Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/hasami/flight_helper.rb
Instance Method Summary collapse
- #arrivals ⇒ Object
- #by_datetime(datetime = DateTime.now) ⇒ Object
- #departure ⇒ Object
- #filter_kind ⇒ Object
- #today ⇒ Object
- #tomorrow ⇒ Object
- #yesterday ⇒ Object
Instance Method Details
#arrivals ⇒ Object
2 3 4 |
# File 'lib/hasami/flight_helper.rb', line 2 def arrivals self.select {|flights| flights.kind == 'Arrivals' } end |
#by_datetime(datetime = DateTime.now) ⇒ Object
22 23 24 |
# File 'lib/hasami/flight_helper.rb', line 22 def by_datetime(datetime = DateTime.now) self.select {|flights| flights.datetime > datetime } end |
#departure ⇒ Object
6 7 8 |
# File 'lib/hasami/flight_helper.rb', line 6 def departure self.select {|flights| flights.kind == 'Departure' } end |
#filter_kind ⇒ Object
26 27 28 29 30 31 |
# File 'lib/hasami/flight_helper.rb', line 26 def filter_kind { Arrivals: self.select {|flights| flights.kind == 'Arrivals'}, Departure: self.select {|flights| flights.kind == 'Departure'} } end |
#today ⇒ Object
14 15 16 |
# File 'lib/hasami/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 ⇒ Object
18 19 20 |
# File 'lib/hasami/flight_helper.rb', line 18 def tomorrow self.select {|flights| flights.datetime.to_time >= Date.today.next_day.to_time } end |
#yesterday ⇒ Object
10 11 12 |
# File 'lib/hasami/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 |