Class: Cooklang::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/cooklang/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recipe) ⇒ Formatter

Returns a new instance of Formatter.



7
8
9
# File 'lib/cooklang/formatter.rb', line 7

def initialize(recipe)
  @recipe = recipe
end

Instance Attribute Details

#recipeObject (readonly)

Returns the value of attribute recipe.



5
6
7
# File 'lib/cooklang/formatter.rb', line 5

def recipe
  @recipe
end

Instance Method Details

#generate(*args) ⇒ Object

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/cooklang/formatter.rb', line 11

def generate(*args)
  raise NotImplementedError, "Subclasses must implement #generate"
end

#to_s(*args) ⇒ Object



15
16
17
# File 'lib/cooklang/formatter.rb', line 15

def to_s(*args)
  generate(*args).to_s
end