Class: Turnip::Node::Rule

Inherits:
ScenarioGroupDefinition show all
Defined in:
lib/turnip/node/rule.rb

Overview

Note:

Rule metadata generated by Gherkin

{

type: :Rule,
location: { line: 10, column: 3 },
keyword: 'Rule',
name: 'Rule name',
description: 'Rule description',
children: [] # Array of Background, Scenario and Scenario Outline

}

Instance Attribute Summary

Attributes inherited from Base

#raw

Instance Method Summary collapse

Methods inherited from ScenarioGroupDefinition

#backgrounds, #description, #keyword, #name, #scenarios

Methods inherited from Base

#initialize

Methods included from HasLocation

#line, #location

Constructor Details

This class inherits a constructor from Turnip::Node::Base

Instance Method Details

#childrenObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/turnip/node/rule.rb', line 18

def children
  @children ||= @raw.children.map do |child|
    if child.is_a?(CukeModeler::Background)
      next Background.new(child)
    end

    if child.is_a?(CukeModeler::Scenario)
      next Scenario.new(child)
    end

    if child.is_a?(CukeModeler::Outline)
      next ScenarioOutline.new(child)
    end
  end.compact
end