Class: DailyMenuApp::Fetcher
- Inherits:
-
Object
- Object
- DailyMenuApp::Fetcher
- Defined in:
- lib/daily_menu_app/fetcher.rb
Instance Method Summary collapse
- #fetch(location) ⇒ Object
- #fetch_menus(location) ⇒ Object
-
#initialize(logger) ⇒ Fetcher
constructor
A new instance of Fetcher.
Constructor Details
#initialize(logger) ⇒ Fetcher
Returns a new instance of Fetcher.
6 7 8 |
# File 'lib/daily_menu_app/fetcher.rb', line 6 def initialize(logger) @logger = logger end |
Instance Method Details
#fetch(location) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/daily_menu_app/fetcher.rb', line 10 def fetch(location) = (location).map do |restaurant, entry| [restaurant.name, convert_entry(entry)] end Hash[] end |
#fetch_menus(location) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/daily_menu_app/fetcher.rb', line 17 def (location) DailyMenu.(location) rescue RuntimeError => e expectation = expectation_class_from(e).new(e.) expectation.set_backtrace(e.backtrace) raise expectation end |