Class: Cucumber::MultilineArgument::DataTable::Cells
- Inherits:
-
Object
- Object
- Cucumber::MultilineArgument::DataTable::Cells
- 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
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #accept(visitor) ⇒ Object
- #dom_id ⇒ Object
- #each(&proc) ⇒ Object
-
#initialize(table, cells) ⇒ Cells
constructor
A new instance of Cells.
- #line ⇒ Object
- #to_hash ⇒ Object
- #to_sexp ⇒ Object
- #value(index) ⇒ Object
Methods included from Gherkin::Formatter::Escaping
Constructor Details
#initialize(table, cells) ⇒ Cells
Returns a new instance of Cells.
532 533 534 535 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 532 def initialize(table, cells) @table = table @cells = cells end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
530 531 532 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 530 def exception @exception end |
Instance Method Details
#[](index) ⇒ Object
558 559 560 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 558 def [](index) @cells[index] end |
#accept(visitor) ⇒ Object
537 538 539 540 541 542 543 544 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 537 def accept(visitor) return if Cucumber.wants_to_quit each do |cell| visitor.visit_table_cell(cell) end nil end |
#dom_id ⇒ Object
566 567 568 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 566 def dom_id "row_#{line}" end |
#each(&proc) ⇒ Object
570 571 572 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 570 def each(&proc) @cells.each(&proc) end |
#line ⇒ Object
562 563 564 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 562 def line @cells[0].line end |
#to_hash ⇒ Object
550 551 552 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 550 def to_hash @to_hash ||= @table.cells_to_hash(self) end |
#to_sexp ⇒ Object
546 547 548 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 546 def to_sexp [:row, line, *@cells.map(&:to_sexp)] end |
#value(index) ⇒ Object
554 555 556 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 554 def value(index) self[index].value end |