Class: CooklangRb::Recipe

Inherits:
Object
  • Object
show all
Includes:
BufferUtils
Defined in:
lib/cooklang_rb/recipe.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BufferUtils

#end_of_buffer?, #end_of_line?

Constructor Details

#initialize(source) ⇒ Recipe

Returns a new instance of Recipe.



17
18
19
20
21
22
# File 'lib/cooklang_rb/recipe.rb', line 17

def initialize(source)
  @source = source
  @steps = []
  @metadata = {}
  parse
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



11
12
13
# File 'lib/cooklang_rb/recipe.rb', line 11

def 
  @metadata
end

#stepsObject (readonly)

Returns the value of attribute steps.



11
12
13
# File 'lib/cooklang_rb/recipe.rb', line 11

def steps
  @steps
end

Class Method Details

.from(source) ⇒ Object



13
14
15
# File 'lib/cooklang_rb/recipe.rb', line 13

def self.from(source)
  new(source).data
end

Instance Method Details

#dataObject



24
25
26
27
28
29
# File 'lib/cooklang_rb/recipe.rb', line 24

def data
  {
    "metadata" => @metadata,
    "steps" => @steps
  }
end