module DailyMenu

Constants

CONFIG_DIR
Entry
OAUTH_TOKEN
ROOT
VERSION

Public Class Methods

file_accessible?(file) click to toggle source
# File lib/daily_menu.rb, line 40
def self.file_accessible?(file)
  File.exists?(file) && File.readable?(file)
end
menus_for(location) click to toggle source
restaurants_for(location) click to toggle source
# File lib/daily_menu.rb, line 25
def self.restaurants_for(location)
  raise ArgumentError, 'Location needed' unless location

  configs = config_for(location)
  configs.map { |config| DailyMenu::Restaurant.from_hash(config) }
end

Private Class Methods

config_for(location) click to toggle source
# File lib/daily_menu.rb, line 32
def self.config_for(location)
  config_file = CONFIG_DIR.join("#{location}.yml").to_s
  raise %(No configuration found for: "#{location}") unless file_accessible?(config_file)

  YAML.load_file(config_file)
end