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 Method Summary collapse

Constructor Details

#initialize(table, cells) ⇒ Cells

Returns a new instance of Cells.



215
216
217
# File 'lib/cucumber/ast/table.rb', line 215

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

Instance Method Details

#[](n) ⇒ Object



239
240
241
# File 'lib/cucumber/ast/table.rb', line 239

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

#accept(visitor, status) ⇒ Object



219
220
221
222
223
224
# File 'lib/cucumber/ast/table.rb', line 219

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

#at_lines?(lines) ⇒ Boolean

Returns:

  • (Boolean)


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

def at_lines?(lines)
  lines.empty? || lines.index(line)
end

#lineObject



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

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



231
232
233
# File 'lib/cucumber/ast/table.rb', line 231

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

#to_sexpObject

For testing only



227
228
229
# File 'lib/cucumber/ast/table.rb', line 227

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

#value(n) ⇒ Object

:nodoc:



235
236
237
# File 'lib/cucumber/ast/table.rb', line 235

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