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.



246
247
248
# File 'lib/cucumber/ast/table.rb', line 246

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



244
245
246
# File 'lib/cucumber/ast/table.rb', line 244

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



270
271
272
# File 'lib/cucumber/ast/table.rb', line 270

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

#accept(visitor) ⇒ Object



250
251
252
253
254
255
# File 'lib/cucumber/ast/table.rb', line 250

def accept(visitor)
  each do |cell|
    visitor.visit_table_cell(cell)
  end
  nil
end

#dom_idObject



278
279
280
# File 'lib/cucumber/ast/table.rb', line 278

def dom_id
  "row_#{line}"
end

#lineObject



274
275
276
# File 'lib/cucumber/ast/table.rb', line 274

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



262
263
264
# File 'lib/cucumber/ast/table.rb', line 262

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

#to_sexpObject

For testing only



258
259
260
# File 'lib/cucumber/ast/table.rb', line 258

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

#value(n) ⇒ Object

:nodoc:



266
267
268
# File 'lib/cucumber/ast/table.rb', line 266

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