Class: Cooklang::Formatter
- Inherits:
-
Object
- Object
- Cooklang::Formatter
- Defined in:
- lib/cooklang/formatter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
Instance Method Summary collapse
- #generate(*args) ⇒ Object
-
#initialize(recipe) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s(*args) ⇒ Object
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
#recipe ⇒ Object (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
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 |