Class: C2eCore::Drops::RecipeDrop

Inherits:
BaseDrop
  • Object
show all
Defined in:
/build/app/mailers/c2e_core/drops/recipe_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(recipe) ⇒ RecipeDrop

Returns a new instance of RecipeDrop.



6
7
8
9
# File '/build/app/mailers/c2e_core/drops/recipe_drop.rb', line 6

def initialize(recipe)
  super()
  @recipe = recipe
end

Instance Method Details

#codeString

Returns - Current code of recipe. E.g.: “m42”.

Returns:

  • (String)
    • Current code of recipe. E.g.: “m42”



19
20
21
# File '/build/app/mailers/c2e_core/drops/recipe_drop.rb', line 19

def code
  @recipe.code
end

#nameString

Returns - Current name of recipe. E.g.: “200g Zbojnický steak”.

Returns:

  • (String)
    • Current name of recipe. E.g.: “200g Zbojnický steak”



12
13
14
15
16
# File '/build/app/mailers/c2e_core/drops/recipe_drop.rb', line 12

def name
  fall_back_language = Language.where(code: @recipe.company_branch.default_language).first

  @recipe.label.translation_with_fallback(::Language.default_locale, fall_back_language)
end