class Turnip::Node::Feature

@note Feature metadata generated by Gherkin

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

Public Instance Methods

children() click to toggle source
# File lib/turnip/node/feature.rb, line 29
def children
  @children ||= @raw[:children].map do |child|
    unless child[:background].nil?
      next Background.new(child[:background])
    end

    unless child[:scenario].nil?
      klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
      next klass.new(child[:scenario])
    end

    unless child[:rule].nil?
      next Rule.new(child[:rule])
    end
  end.compact
end
language() click to toggle source
# File lib/turnip/node/feature.rb, line 25
def language
  @raw[:language]
end
metadata_hash() click to toggle source
Calls superclass method Turnip::Node::HasTags#metadata_hash
# File lib/turnip/node/feature.rb, line 52
def metadata_hash
  super.merge(:type => Turnip.type, :turnip => true)
end
rules() click to toggle source
# File lib/turnip/node/feature.rb, line 46
def rules
  @rules ||= children.select do |c|
    c.is_a?(Rule)
  end
end