Class: Gherkin::Formatter::Model::Step

Inherits:
BasicStatement show all
Defined in:
lib/gherkin/formatter/model.rb

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Attributes inherited from BasicStatement

#comments, #keyword, #line, #name

Instance Method Summary collapse

Methods inherited from BasicStatement

#first_non_comment_line

Methods inherited from Hashable

#to_hash

Constructor Details

#initialize(comments, keyword, name, line, rows, doc_string) ⇒ 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_stringObject (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

#rowsObject (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_rangeObject


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_argsObject


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