Class: Gherkin::Formatter::Model::BasicStatement

Inherits:
Hashable
  • Object
show all
Defined in:
lib/gherkin/formatter/model.rb

Direct Known Subclasses

DescribedStatement, Step

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Hashable

#to_hash

Constructor Details

#initialize(comments, keyword, name, line) ⇒ BasicStatement

Returns a new instance of BasicStatement.



10
11
12
# File 'lib/gherkin/formatter/model.rb', line 10

def initialize(comments, keyword, name, line)
  @comments, @keyword, @name, @line = comments, keyword, name, line
end

Instance Attribute Details

#commentsObject (readonly)

Returns the value of attribute comments.



8
9
10
# File 'lib/gherkin/formatter/model.rb', line 8

def comments
  @comments
end

#keywordObject (readonly)

Returns the value of attribute keyword.



8
9
10
# File 'lib/gherkin/formatter/model.rb', line 8

def keyword
  @keyword
end

#lineObject (readonly)

Returns the value of attribute line.



8
9
10
# File 'lib/gherkin/formatter/model.rb', line 8

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/gherkin/formatter/model.rb', line 8

def name
  @name
end

Instance Method Details

#first_non_comment_lineObject



19
20
21
# File 'lib/gherkin/formatter/model.rb', line 19

def first_non_comment_line
  @line
end

#line_rangeObject



14
15
16
17
# File 'lib/gherkin/formatter/model.rb', line 14

def line_range
  first = @comments.any? ? @comments[0].line : first_non_comment_line
  first..line
end