Class: Cucumber::Ast::Table::Cells

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Gherkin::Formatter::Escaping
Defined in:
lib/cucumber/ast/table.rb

Overview

Represents a row of cells or columns of cells

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, cells) ⇒ Cells

Returns a new instance of Cells.



636
637
638
# File 'lib/cucumber/ast/table.rb', line 636

def initialize(table, cells)
  @table, @cells = table, cells
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



634
635
636
# File 'lib/cucumber/ast/table.rb', line 634

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



661
662
663
# File 'lib/cucumber/ast/table.rb', line 661

def [](n)
  @cells[n]
end

#accept(visitor) ⇒ Object



640
641
642
643
644
645
646
# File 'lib/cucumber/ast/table.rb', line 640

def accept(visitor)
  return if Cucumber.wants_to_quit
  each do |cell|
    visitor.visit_table_cell(cell)
  end
  nil
end

#dom_idObject



669
670
671
# File 'lib/cucumber/ast/table.rb', line 669

def dom_id
  "row_#{line}"
end

#lineObject



665
666
667
# File 'lib/cucumber/ast/table.rb', line 665

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



653
654
655
# File 'lib/cucumber/ast/table.rb', line 653

def to_hash #:nodoc:
  @to_hash ||= @table.to_hash(self)
end

#to_sexpObject

For testing only



649
650
651
# File 'lib/cucumber/ast/table.rb', line 649

def to_sexp #:nodoc:
  [:row, line, *@cells.map{|cell| cell.to_sexp}]
end

#value(n) ⇒ Object

:nodoc:



657
658
659
# File 'lib/cucumber/ast/table.rb', line 657

def value(n) #:nodoc:
  self[n].value
end