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.



536
537
538
# File 'lib/cucumber/ast/table.rb', line 536

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



534
535
536
# File 'lib/cucumber/ast/table.rb', line 534

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



561
562
563
# File 'lib/cucumber/ast/table.rb', line 561

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

#accept(visitor) ⇒ Object



540
541
542
543
544
545
546
# File 'lib/cucumber/ast/table.rb', line 540

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

#dom_idObject



569
570
571
# File 'lib/cucumber/ast/table.rb', line 569

def dom_id
  "row_#{line}"
end

#lineObject



565
566
567
# File 'lib/cucumber/ast/table.rb', line 565

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



553
554
555
# File 'lib/cucumber/ast/table.rb', line 553

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

#to_sexpObject

For testing only



549
550
551
# File 'lib/cucumber/ast/table.rb', line 549

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

#value(n) ⇒ Object

:nodoc:



557
558
559
# File 'lib/cucumber/ast/table.rb', line 557

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