Class: RestaurantPackageTypesCached

Inherits:
Object
  • Object
show all
Defined in:
app/my_lib/restaurant_package_types_cached.rb

Overview

Fetch available package types based on restaurant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(restaurant_id) ⇒ RestaurantPackageTypesCached

Returns a new instance of RestaurantPackageTypesCached.



8
9
10
11
# File 'app/my_lib/restaurant_package_types_cached.rb', line 8

def initialize(restaurant_id)
  self.restaurant_id = restaurant_id
  @restaurant = {}
end

Instance Attribute Details

#restaurant_idObject

Returns the value of attribute restaurant_id.



7
8
9
# File 'app/my_lib/restaurant_package_types_cached.rb', line 7

def restaurant_id
  @restaurant_id
end

Instance Method Details

#restaurantObject



21
22
23
# File 'app/my_lib/restaurant_package_types_cached.rb', line 21

def restaurant
  @restaurant[restaurant_id] ||= Restaurant.fetch(restaurant_id)
end