Class: Cucumber::Core::Ast::DataTable::Cells

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Gherkin::Formatter::Escaping
Defined in:
lib/cucumber/core/ast/data_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.



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

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



264
265
266
# File 'lib/cucumber/core/ast/data_table.rb', line 264

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



283
284
285
# File 'lib/cucumber/core/ast/data_table.rb', line 283

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

#lineObject



287
288
289
# File 'lib/cucumber/core/ast/data_table.rb', line 287

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



275
276
277
# File 'lib/cucumber/core/ast/data_table.rb', line 275

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

#to_sexpObject

For testing only



271
272
273
# File 'lib/cucumber/core/ast/data_table.rb', line 271

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

#value(n) ⇒ Object

:nodoc:



279
280
281
# File 'lib/cucumber/core/ast/data_table.rb', line 279

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