Class: CucumberAnalytics::Table

Inherits:
Object
  • Object
show all
Includes:
Containing, Nested, Raw
Defined in:
lib/cucumber_analytics/table.rb

Overview

A class modeling the table of a Step.

Instance Attribute Summary collapse

Attributes included from Nested

#parent_element

Attributes included from Raw

#raw_element

Instance Method Summary collapse

Methods included from Nested

#get_ancestor

Constructor Details

#initialize(source = nil) ⇒ Table

Creates a new Table object and, if source is provided, populates the object.



23
24
25
26
27
28
29
30
# File 'lib/cucumber_analytics/table.rb', line 23

def initialize(source = nil)
  @contents = []
  @row_elements = []

  parsed_table = process_source(source)

  build_table(parsed_table) if parsed_table
end

Instance Attribute Details

#contentsObject

The contents of the table

Deprecated



15
16
17
# File 'lib/cucumber_analytics/table.rb', line 15

def contents
  @contents
end

#row_elementsObject

The row elements that make up the table



18
19
20
# File 'lib/cucumber_analytics/table.rb', line 18

def row_elements
  @row_elements
end

Instance Method Details

#to_sObject

Returns a gherkin representation of the table.



33
34
35
# File 'lib/cucumber_analytics/table.rb', line 33

def to_s
  row_elements.empty? ? '' : row_elements.collect { |row| row_output_string(row) }.join("\n")
end