Class: Turnip::Node::Step

Inherits:
Base
  • Object
show all
Defined in:
lib/turnip/node/step.rb

Overview

Note:

Step metadata generated by Gherkin

{

type: :Step,
location: { line: 10, column: 3 },
keyword: 'Step',
text: 'Step description',
argument: {}, # DocString or DataTable

}

Instance Attribute Summary

Attributes inherited from Base

#raw

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from HasLocation

#line, #location

Constructor Details

This class inherits a constructor from Turnip::Node::Base

Instance Method Details

#argumentObject



34
35
36
37
38
39
40
41
# File 'lib/turnip/node/step.rb', line 34

def argument
  @argument ||= case
                when @raw.block&.is_a?(CukeModeler::DocString)
                  doc_string(@raw.block)
                when @raw.block&.is_a?(CukeModeler::Table)
                  data_table(@raw.block)
                end
end

#descriptionObject

Backward compatibility



30
31
32
# File 'lib/turnip/node/step.rb', line 30

def description
  text
end

#keywordObject



18
19
20
21
# File 'lib/turnip/node/step.rb', line 18

def keyword
  # TODO: Do we want to keep the whitespace?
  @raw.keyword + ' '
end

#textObject



23
24
25
# File 'lib/turnip/node/step.rb', line 23

def text
  @raw.text
end

#to_sObject



43
44
45
# File 'lib/turnip/node/step.rb', line 43

def to_s
  "#{keyword}#{text}"
end