class ImHungry::FoodTruck

Constants

TZ

Attributes

applicant[RW]
dayorder[RW]
end24[RW]
location[RW]
start24[RW]

Public Class Methods

new(food_truck) click to toggle source
# File lib/im_hungry/food_truck.rb, line 8
def initialize(food_truck)
  self.start24 = food_truck["start24"]
  self.end24 = food_truck["end24"]
  self.dayorder = food_truck["dayorder"]
  self.applicant = food_truck["applicant"]
  self.location = food_truck["location"]
end

Public Instance Methods

currently_open?() click to toggle source
# File lib/im_hungry/food_truck.rb, line 40
def currently_open?
  is_current_day_of_week? && has_started? && has_ended?
end
end_time() click to toggle source
# File lib/im_hungry/food_truck.rb, line 24
def end_time
  parse_time(end24)
end
has_ended?() click to toggle source
# File lib/im_hungry/food_truck.rb, line 36
def has_ended?
  end_time > current_time
end
has_started?() click to toggle source
# File lib/im_hungry/food_truck.rb, line 32
def has_started?
  start_time <= current_time
end
is_current_day_of_week?() click to toggle source
# File lib/im_hungry/food_truck.rb, line 28
def is_current_day_of_week?
  wday == current_time.wday
end
start_time() click to toggle source
# File lib/im_hungry/food_truck.rb, line 20
def start_time
  parse_time(start24)
end
time_zone() click to toggle source
# File lib/im_hungry/food_truck.rb, line 44
def time_zone
  TZ
end
to_s() click to toggle source
# File lib/im_hungry/food_truck.rb, line 48
def to_s
  "#{applicant} at #{location}"
end
wday() click to toggle source
# File lib/im_hungry/food_truck.rb, line 16
def wday
  dayorder&.to_i
end