class Cukedep::FeatureRep

A FeatureRep is the internal representation of a Gherkin feature.

Constants

DependencyPrefix

Constant that specifies how dependency tags should begin

FeatureIdPrefix

Constant that specifies how feature identifier tags should begin

Attributes

identifier[R]

The identifier of the feature. It comes from a tag with the following syntax '@feature:' + identifier. Note that the @feature: prefix is removed.

tags[R]

The sorted list of all tags of the feature. The @ prefix is stripped from each tag text.

Public Class Methods

new(theTags) click to toggle source

@param theTags [Array<String>] the tags objects from the Gherkin parser

# File lib/cukedep/feature-rep.rb, line 23
def initialize(theTags)
  # Strip first character of tag literal.
  @tags = theTags.map { |t| t[1..-1] }

  @identifier = tags.find { |tg| tg =~ FeatureIdPrefix }
  @identifier = @identifier.sub(FeatureIdPrefix, '') unless identifier.nil?
end

Public Instance Methods

anonymous?() click to toggle source

Return true iff the identifier of the feature is nil.

# File lib/cukedep/feature-rep.rb, line 38
def anonymous?
  return identifier.nil?
end
dependency_tags() click to toggle source

The list of all feature identifiers retrieved from the dependency tags

# File lib/cukedep/feature-rep.rb, line 32
def dependency_tags
  dep_tags = tags.select { |t| t =~ DependencyPrefix }
  return dep_tags.map { |t| t.sub(DependencyPrefix, '') }
end