Class: Cukedep::FeatureRep
- Inherits:
-
Object
- Object
- Cukedep::FeatureRep
- Defined in:
- lib/cukedep/feature-rep.rb
Overview
A FeatureRep is the internal representation of a Gherkin feature.
Constant Summary collapse
- FeatureIdPrefix =
Constant that specifies how feature identifier tags should begin
/^feature:/
- DependencyPrefix =
Constant that specifies how dependency tags should begin
/^depends_on:/
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
The identifier of the feature.
-
#tags ⇒ Object
readonly
The sorted list of all tags of the feature.
Instance Method Summary collapse
-
#anonymous? ⇒ Boolean
Return true iff the identifier of the feature is nil.
-
#dependency_tags ⇒ Object
The list of all feature identifiers retrieved from the dependency tags.
-
#initialize(theTags) ⇒ FeatureRep
constructor
A new instance of FeatureRep.
Constructor Details
#initialize(theTags) ⇒ FeatureRep
Returns a new instance of FeatureRep.
23 24 25 26 27 28 29 |
# 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 = .find { |tg| tg =~ FeatureIdPrefix } @identifier = @identifier.sub(FeatureIdPrefix, '') unless identifier.nil? end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
The identifier of the feature. It comes from a tag with the following syntax '@feature:' + identifier. Note that the @feature: prefix is removed.
19 20 21 |
# File 'lib/cukedep/feature-rep.rb', line 19 def identifier @identifier end |
#tags ⇒ Object (readonly)
The sorted list of all tags of the feature. The @ prefix is stripped from each tag text.
14 15 16 |
# File 'lib/cukedep/feature-rep.rb', line 14 def @tags end |
Instance Method Details
#anonymous? ⇒ Boolean
Return true iff the identifier of the feature is nil.
38 39 40 |
# File 'lib/cukedep/feature-rep.rb', line 38 def anonymous? return identifier.nil? end |
#dependency_tags ⇒ Object
The list of all feature identifiers retrieved from the dependency tags
32 33 34 35 |
# File 'lib/cukedep/feature-rep.rb', line 32 def = .select { |t| t =~ DependencyPrefix } return .map { |t| t.sub(DependencyPrefix, '') } end |