Class: Cooklang::Processors::StepProcessor
- Inherits:
-
Object
- Object
- Cooklang::Processors::StepProcessor
- Defined in:
- lib/cooklang/processors/step_processor.rb
Class Method Summary collapse
Class Method Details
.parse_steps(tokens) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cooklang/processors/step_processor.rb', line 7 def parse_steps(tokens) # Group tokens into steps (separated by blank lines) step_groups = split_into_step_groups(tokens) # Parse each step group into step data steps = step_groups.map { |step_tokens| parse_step(step_tokens) } # Filter out nil steps (those without content) steps.compact.select { |step_data| step_data.is_a?(Hash) && has_content?(step_data[:segments]) } end |