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



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

def argument
  @argument ||= case
                when @raw[:doc_string]
                  doc_string(@raw[:doc_string])
                when @raw[:data_table]
                  data_table(@raw[:data_table])
                end
end

#descriptionObject

Backward compatibility



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

def description
  text
end

#keywordObject



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

def keyword
  @raw[:keyword]
end

#textObject



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

def text
  @raw[:text]
end

#to_sObject



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

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