Class: Cucumber::MultilineArgument::DataTable::Cells

Inherits:
Object
  • Object
show all
Includes:
Gherkin::Formatter::Escaping, Enumerable
Defined in:
lib/cucumber/multiline_argument/data_table.rb

Overview

Represents a row of cells or columns of cells

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gherkin::Formatter::Escaping

#escape_cell

Constructor Details

#initialize(table, cells) ⇒ Cells

Returns a new instance of Cells.



513
514
515
# File 'lib/cucumber/multiline_argument/data_table.rb', line 513

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



511
512
513
# File 'lib/cucumber/multiline_argument/data_table.rb', line 511

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object



538
539
540
# File 'lib/cucumber/multiline_argument/data_table.rb', line 538

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

#accept(visitor) ⇒ Object



517
518
519
520
521
522
523
# File 'lib/cucumber/multiline_argument/data_table.rb', line 517

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

#dom_idObject



546
547
548
# File 'lib/cucumber/multiline_argument/data_table.rb', line 546

def dom_id
  "row_#{line}"
end

#each(&proc) ⇒ Object



550
551
552
# File 'lib/cucumber/multiline_argument/data_table.rb', line 550

def each(&proc)
  @cells.each(&proc)
end

#lineObject



542
543
544
# File 'lib/cucumber/multiline_argument/data_table.rb', line 542

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



530
531
532
# File 'lib/cucumber/multiline_argument/data_table.rb', line 530

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

#to_sexpObject

For testing only



526
527
528
# File 'lib/cucumber/multiline_argument/data_table.rb', line 526

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

#value(n) ⇒ Object

:nodoc:



534
535
536
# File 'lib/cucumber/multiline_argument/data_table.rb', line 534

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