Class: Gherkin::Formatter::Model::Step
- Inherits:
-
BasicStatement
- Object
- Hashable
- BasicStatement
- Gherkin::Formatter::Model::Step
- Defined in:
- lib/gherkin/formatter/model.rb
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#doc_string ⇒ Object
readonly
Returns the value of attribute doc_string.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Attributes inherited from BasicStatement
#comments, #keyword, #line, #name
Instance Method Summary collapse
-
#initialize(comments, keyword, name, line, rows, doc_string) ⇒ Step
constructor
A new instance of Step.
- #line_range ⇒ Object
- #outline_args ⇒ Object
- #replay(formatter) ⇒ Object
Methods inherited from BasicStatement
Methods inherited from Hashable
Constructor Details
#initialize(comments, keyword, name, line, rows, doc_string) ⇒ Step
Returns a new instance of Step.
134 135 136 137 |
# File 'lib/gherkin/formatter/model.rb', line 134 def initialize(comments, keyword, name, line, rows, doc_string) super(comments, keyword, name, line) @rows, @doc_string = rows, doc_string end |
Instance Attribute Details
#doc_string ⇒ Object (readonly)
Returns the value of attribute doc_string.
132 133 134 |
# File 'lib/gherkin/formatter/model.rb', line 132 def doc_string @doc_string end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
132 133 134 |
# File 'lib/gherkin/formatter/model.rb', line 132 def rows @rows end |
Instance Method Details
#line_range ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/gherkin/formatter/model.rb', line 139 def line_range range = super if(rows) range = range.first..rows[-1].line elsif(doc_string) range = range.first..doc_string.line_range.last end range end |
#outline_args ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/gherkin/formatter/model.rb', line 153 def outline_args offset = 0 name.scan(/<[^<]*>/).map do |val| offset = name.index(val, offset) Argument.new(offset, val) end end |
#replay(formatter) ⇒ Object
149 150 151 |
# File 'lib/gherkin/formatter/model.rb', line 149 def replay(formatter) formatter.step(self) end |