Class: Jekyll::Converters::Step

Inherits:
ToHTML
  • Object
show all
Defined in:
lib/jekyll/converters/cooklang.rb

Instance Method Summary collapse

Methods inherited from ToHTML

#to_list_item

Constructor Details

#initialize(step) ⇒ Step

Returns a new instance of Step.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/jekyll/converters/cooklang.rb', line 86

def initialize(step)
  @text = step.map do |substep|
    case substep["type"]
    when "cookware"
      substep["name"]
    when "ingredient"
      substep["name"]
    when "timer"
      "#{substep["quantity"]} #{substep["units"]}"
    when "text"
      substep["value"]
    end
  end.join
end

Instance Method Details

#to_htmlObject



101
102
103
# File 'lib/jekyll/converters/cooklang.rb', line 101

def to_html
  "<p>#{@text}</p>"
end