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
41
42
# File 'lib/turnip/node/step.rb', line 33

def argument
  return nil if @raw[:argument].nil?

  @argument ||= case @raw[:argument][:type]
                when :DocString
                  doc_string(@raw[:argument])
                when :DataTable
                  data_table(@raw[:argument])
                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



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

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