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.



256
257
258
# File 'lib/cucumber/ast/table.rb', line 256

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



254
255
256
# File 'lib/cucumber/ast/table.rb', line 254

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



284
285
286
# File 'lib/cucumber/ast/table.rb', line 284

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

#accept(visitor) ⇒ Object



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

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

#dom_idObject



292
293
294
# File 'lib/cucumber/ast/table.rb', line 292

def dom_id
  "row_#{line}"
end

#lineObject



288
289
290
# File 'lib/cucumber/ast/table.rb', line 288

def line
  @cells[0].line
end

#matches_lines?(lines) ⇒ Boolean

Returns:

  • (Boolean)


260
261
262
# File 'lib/cucumber/ast/table.rb', line 260

def matches_lines?(lines)
  lines.index(line)
end

#status=(status) ⇒ Object



296
297
298
299
300
# File 'lib/cucumber/ast/table.rb', line 296

def status=(status)
  each do |cell|
    cell.status = status
  end
end

#to_hashObject

:nodoc:



276
277
278
# File 'lib/cucumber/ast/table.rb', line 276

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

#to_sexpObject

For testing only



272
273
274
# File 'lib/cucumber/ast/table.rb', line 272

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

#value(n) ⇒ Object

:nodoc:



280
281
282
# File 'lib/cucumber/ast/table.rb', line 280

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