Class: Cooklang::Formatters::Text

Inherits:
Cooklang::Formatter show all
Defined in:
lib/cooklang/formatters/text.rb

Instance Attribute Summary

Attributes inherited from Cooklang::Formatter

#recipe

Instance Method Summary collapse

Methods inherited from Cooklang::Formatter

#initialize, #to_s

Constructor Details

This class inherits a constructor from Cooklang::Formatter

Instance Method Details

#generate(*args) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/cooklang/formatters/text.rb', line 6

def generate(*args)
  sections = []

  sections << ingredients_section unless recipe.ingredients.empty?
  sections << steps_section unless recipe.steps.empty?

  sections.join("\n").strip
end