Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/hasami/flight_helper.rb

Instance Method Summary collapse

Instance Method Details

#arrivalsObject



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

#departureObject



6
7
8
# File 'lib/hasami/flight_helper.rb', line 6

def departure
  self.select {|flights| flights.kind == 'Departure' }
end

#filter_kindObject



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

#todayObject



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

#tomorrowObject



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

#yesterdayObject



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