class CucumberJunitToJson::Models::Table

Abstract representation of a cucumber step table attribute

Attributes

headings[RW]
rows[RW]

Public Class Methods

new() click to toggle source
# File lib/cucumber_junit_to_json/models/table.rb, line 10
def initialize
  @headings = []
  @rows = []
end
parse(data) click to toggle source
# File lib/cucumber_junit_to_json/models/table.rb, line 15
def self.parse(data)
  table = Table.new
  table.headings = data.first.split('|').compact.collect(&:strip).reject(&:empty?)
  rows = []
  data.drop(1).each do |row|
    rows.push(row.split('|').compact.collect(&:strip).reject(&:empty?))
  end
  table.rows = rows
  table
end