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.


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

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception


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

def exception
  @exception
end

Instance Method Details

#[](n) ⇒ Object


565
566
567
# File 'lib/cucumber/multiline_argument/data_table.rb', line 565

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

#accept(visitor) ⇒ Object


544
545
546
547
548
549
550
# File 'lib/cucumber/multiline_argument/data_table.rb', line 544

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

#dom_idObject


573
574
575
# File 'lib/cucumber/multiline_argument/data_table.rb', line 573

def dom_id
  "row_#{line}"
end

#each(&proc) ⇒ Object


577
578
579
# File 'lib/cucumber/multiline_argument/data_table.rb', line 577

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

#lineObject


569
570
571
# File 'lib/cucumber/multiline_argument/data_table.rb', line 569

def line
  @cells[0].line
end

#to_hashObject

:nodoc:


557
558
559
# File 'lib/cucumber/multiline_argument/data_table.rb', line 557

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

#to_sexpObject

For testing only


553
554
555
# File 'lib/cucumber/multiline_argument/data_table.rb', line 553

def to_sexp #:nodoc:
  [:row, line, *@cells.map(&:to_sexp)]
end

#value(n) ⇒ Object

:nodoc:


561
562
563
# File 'lib/cucumber/multiline_argument/data_table.rb', line 561

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