Class: Restaurants::PictureDecorator

Inherits:
Object
  • Object
show all
Defined in:
app/decorators/restaurants/picture_decorator.rb

Overview

Decorate Restaurants::Picture instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(picture) ⇒ PictureDecorator

Returns a new instance of PictureDecorator.



10
11
12
13
# File 'app/decorators/restaurants/picture_decorator.rb', line 10

def initialize(picture)
  self.picture = picture
  @package_list = {}
end

Instance Attribute Details

#pictureObject

Returns the value of attribute picture.



6
7
8
# File 'app/decorators/restaurants/picture_decorator.rb', line 6

def picture
  @picture
end

Instance Method Details

#decorated_captionObject



15
16
17
18
19
20
21
22
# File 'app/decorators/restaurants/picture_decorator.rb', line 15

def decorated_caption
  suffix = if package_list.include_ayce? || package_list.include_bfp?
             I18n.t('seo.restaurants.photos.caption_ayce_like', name: package_list.restaurant&.name)
           else # Party Pack
             I18n.t('seo.restaurants.photos.caption_pp_like', name: package_list.restaurant&.name)
           end
  [picture&.caption, suffix].compact.join(' - ')
end