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.



25
26
27
# File 'lib/gherkin/formatter/model.rb', line 25

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.



23
24
25
# File 'lib/gherkin/formatter/model.rb', line 23

def comments
  @comments
end

#keywordObject (readonly)

Returns the value of attribute keyword.



23
24
25
# File 'lib/gherkin/formatter/model.rb', line 23

def keyword
  @keyword
end

#lineObject (readonly)

Returns the value of attribute line.



23
24
25
# File 'lib/gherkin/formatter/model.rb', line 23

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/gherkin/formatter/model.rb', line 23

def name
  @name
end

Instance Method Details

#first_non_comment_lineObject



34
35
36
# File 'lib/gherkin/formatter/model.rb', line 34

def first_non_comment_line
  @line
end

#line_rangeObject



29
30
31
32
# File 'lib/gherkin/formatter/model.rb', line 29

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