Class: Turnip::Node::Example

Inherits:
Base
  • Object
show all
Includes:
HasTags
Defined in:
lib/turnip/node/example.rb

Overview

Note:

Example metadata generated by Gherkin

{

type: :Examples,
tags: [], # Array of Tag
location: { line: 10, column: 3 },
keyword: "Examples",
name: "Example Description",
tableHeader: {},
tableBody: {}

}

Instance Attribute Summary

Attributes inherited from Base

#raw

Instance Method Summary collapse

Methods included from HasTags

#metadata_hash, #tag_names, #tags

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

#descriptionObject



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

def description
  @raw.description
end

#headerArray

Note:

Examples: | monster | hp | | slime | 10 | => [ ‘monster’, ‘hp’ ] | daemon | 70 |

Returns:

  • (Array)


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

def header
  @header ||= @raw.parameter_row.cells.map { |c| c.value }
end

#keywordObject



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

def keyword
  @raw.keyword
end

#nameObject



26
27
28
# File 'lib/turnip/node/example.rb', line 26

def name
  @raw.name
end

#rowsArray

Note:

Examples: | monster | hp | | slime | 10 | => [ [‘slime’, ‘10’], [‘daemon’, ‘70’] ] | daemon | 70 |

Returns:

  • (Array)


58
59
60
61
62
# File 'lib/turnip/node/example.rb', line 58

def rows
  @rows ||= @raw.argument_rows.map do |row|
    row.cells.map { |c| c.value }
  end
end