Module: DailyMenu
- Defined in:
- lib/daily_menu.rb,
lib/daily_menu/cli.rb,
lib/daily_menu/entry.rb,
lib/daily_menu/version.rb,
lib/daily_menu/restaurant.rb,
lib/daily_menu/scrapers/facebook.rb
Defined Under Namespace
Modules: Filters, Scrapers
Classes: CLI, ColoredFormatter, Entry, MarkdownFormatter, Restaurant
Constant Summary
collapse
- OAUTH_TOKEN =
ENV['FACEBOOK_OAUTH_TOKEN'].freeze
- ROOT =
Pathname.new(File.expand_path('../..', __FILE__)).freeze
- CONFIG_DIR =
ROOT.join('configs').freeze
- VERSION =
'0.0.5'.freeze
Class Method Summary
collapse
Class Method Details
.file_accessible?(file) ⇒ Boolean
40
41
42
|
# File 'lib/daily_menu.rb', line 40
def self.file_accessible?(file)
File.exists?(file) && File.readable?(file)
end
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/daily_menu.rb', line 9
def self.(location)
restaurants = .restaurants_for(location)
= []
threads = restaurants.map do |restaurant|
Thread.new do
<< [restaurant, restaurant.]
end
end
threads.map(&:join)
end
|
.restaurants_for(location) ⇒ Object
25
26
27
28
29
30
|
# 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| ::Restaurant.from_hash(config) }
end
|