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.



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

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



559
560
561
# File 'lib/cucumber/ast/table.rb', line 559

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



586
587
588
# File 'lib/cucumber/ast/table.rb', line 586

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

#accept(visitor) ⇒ Object



565
566
567
568
569
570
571
# File 'lib/cucumber/ast/table.rb', line 565

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

#dom_idObject



594
595
596
# File 'lib/cucumber/ast/table.rb', line 594

def dom_id
  "row_#{line}"
end

#lineObject



590
591
592
# File 'lib/cucumber/ast/table.rb', line 590

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



578
579
580
# File 'lib/cucumber/ast/table.rb', line 578

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

#to_sexpObject

For testing only



574
575
576
# File 'lib/cucumber/ast/table.rb', line 574

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

#value(n) ⇒ Object

:nodoc:



582
583
584
# File 'lib/cucumber/ast/table.rb', line 582

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