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

Inherits:
Object
  • Object
show all
Includes:
Enumerable
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.



498
499
500
# File 'lib/cucumber/ast/table.rb', line 498

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



496
497
498
# File 'lib/cucumber/ast/table.rb', line 496

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



523
524
525
# File 'lib/cucumber/ast/table.rb', line 523

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

#accept(visitor) ⇒ Object



502
503
504
505
506
507
508
# File 'lib/cucumber/ast/table.rb', line 502

def accept(visitor)
  return if $cucumber_interrupted
  each do |cell|
    visitor.visit_table_cell(cell)
  end
  nil
end

#dom_idObject



531
532
533
# File 'lib/cucumber/ast/table.rb', line 531

def dom_id
  "row_#{line}"
end

#lineObject



527
528
529
# File 'lib/cucumber/ast/table.rb', line 527

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



515
516
517
# File 'lib/cucumber/ast/table.rb', line 515

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

#to_sexpObject

For testing only



511
512
513
# File 'lib/cucumber/ast/table.rb', line 511

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

#value(n) ⇒ Object

:nodoc:



519
520
521
# File 'lib/cucumber/ast/table.rb', line 519

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