Sha256: 897642c0a0599544a45a10c78546d36cfabfb8c4c357ad608e52dd3a9da381d1
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module CucumberAnalytics # A class modeling the table of a Step. class Table include Raw # The parent object that contains *self* attr_accessor :parent_element # The contents of the table attr_accessor :contents # Creates a new Table object and, if *source* is provided, populates # the object. def initialize(source = nil) @contents = [] parsed_table = process_source(source) build_table(parsed_table) if parsed_table end private def process_source(source) case when source.is_a?(String) parse_table(source) else source end end def parse_table(source_text) base_file_string = "Feature:\nScenario:\n* step\n" source_text = base_file_string + source_text parsed_file = Parsing::parse_text(source_text) parsed_file.first['elements'].first['steps'].first['rows'] end def build_table(table) populate_contents(table) populate_raw_element(table) end def populate_contents(table) @contents = table.collect { |row| row['cells'] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cucumber_analytics-1.2.0 | lib/cucumber_analytics/table.rb |