Class: Cukehead::FeatureNodeTags
- Inherits:
-
Object
- Object
- Cukehead::FeatureNodeTags
- Defined in:
- lib/cukehead/feature_node_tags.rb
Overview
Responsible for holding a string of tags extracted from a mind map node and providing it in the format used in a Cucumber feature file.
Instance Method Summary collapse
-
#from_text(text) ⇒ Object
Extracts the substring containing the tags from a string in the format Tags: tag1 tag2 ===Parameters
text
- String containing tags from mind map node text. -
#initialize ⇒ FeatureNodeTags
constructor
A new instance of FeatureNodeTags.
-
#to_text(pad) ⇒ Object
Returns the string of tags extracted by from_text in the format needed for output to a feature file.
Constructor Details
#initialize ⇒ FeatureNodeTags
Returns a new instance of FeatureNodeTags.
8 9 10 |
# File 'lib/cukehead/feature_node_tags.rb', line 8 def initialize @tagstr = '' end |
Instance Method Details
#from_text(text) ⇒ Object
Extracts the substring containing the tags from a string in the format Tags: tag1 tag2
Parameters
text
- String containing tags from mind map node text.
18 19 20 21 22 23 |
# File 'lib/cukehead/feature_node_tags.rb', line 18 def from_text(text) a = text.split(':') if a.length == 2 @tagstr = a[1].strip end end |
#to_text(pad) ⇒ Object
Returns the string of tags extracted by from_text in the format needed for output to a feature file.
Parameters
pad
- String of whitespace to use to indent the tags.
31 32 33 34 35 36 37 |
# File 'lib/cukehead/feature_node_tags.rb', line 31 def to_text(pad) if @tagstr.length == 0 '' else pad + @tagstr + "\n" end end |