Class: Gherkin::Listener::FormatterListener::Stash
- Inherits:
-
Object
- Object
- Gherkin::Listener::FormatterListener::Stash
- Defined in:
- lib/gherkin/listener/formatter_listener.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #basic_statement {|@comments, "#{@examples_id};#{@row_index}"| ... } ⇒ Object
- #comment(comment) ⇒ Object
- #examples(name) {|@comments, @tags, @examples_id| ... } ⇒ Object
- #feature(name) {|@comments, @tags, @feature_id| ... } ⇒ Object
- #feature_element(name) {|@comments, @tags, @feature_element_id| ... } ⇒ Object
- #id(name) ⇒ Object
-
#initialize ⇒ Stash
constructor
A new instance of Stash.
- #tag(tag) ⇒ Object
Constructor Details
#initialize ⇒ Stash
Returns a new instance of Stash.
93 94 95 96 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 93 def initialize @comments, @tags, @ids = [], [], [] @row_index = 0 end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
91 92 93 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 91 def comments @comments end |
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
91 92 93 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 91 def ids @ids end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
91 92 93 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 91 def @tags end |
Instance Method Details
#basic_statement {|@comments, "#{@examples_id};#{@row_index}"| ... } ⇒ Object
121 122 123 124 125 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 121 def basic_statement @row_index += 1 yield @comments, "#{@examples_id};#{@row_index}" @comments = [] end |
#comment(comment) ⇒ Object
98 99 100 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 98 def comment(comment) @comments << comment end |
#examples(name) {|@comments, @tags, @examples_id| ... } ⇒ Object
114 115 116 117 118 119 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 114 def examples(name) @examples_id = "#{@feature_element_id};#{id(name)}" @row_index = 0 yield @comments, @tags, @examples_id @comments, @tags = [], [] end |
#feature(name) {|@comments, @tags, @feature_id| ... } ⇒ Object
102 103 104 105 106 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 102 def feature(name) @feature_id = id(name) yield @comments, @tags, @feature_id @comments, @tags = [], [] end |
#feature_element(name) {|@comments, @tags, @feature_element_id| ... } ⇒ Object
108 109 110 111 112 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 108 def feature_element(name) @feature_element_id = "#{@feature_id};#{id(name)}" yield @comments, @tags, @feature_element_id @comments, @tags = [], [] end |
#id(name) ⇒ Object
131 132 133 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 131 def id(name) (name || '').gsub(/[\s_]/, '-').downcase end |
#tag(tag) ⇒ Object
127 128 129 |
# File 'lib/gherkin/listener/formatter_listener.rb', line 127 def tag(tag) @tags << tag end |