Class: Cucumber::Ast::Table::Cells
- Includes:
- Enumerable
- Defined in:
- lib/cucumber/ast/table.rb
Overview
Represents a row of cells or columns of cells
Instance Method Summary collapse
- #[](n) ⇒ Object
- #accept(visitor, status) ⇒ Object
- #at_lines?(lines) ⇒ Boolean
-
#initialize(table, cells) ⇒ Cells
constructor
A new instance of Cells.
- #line ⇒ Object
-
#to_hash ⇒ Object
:nodoc:.
-
#to_sexp ⇒ Object
For testing only.
-
#value(n) ⇒ Object
:nodoc:.
Constructor Details
#initialize(table, cells) ⇒ Cells
Returns a new instance of Cells.
139 140 141 |
# File 'lib/cucumber/ast/table.rb', line 139 def initialize(table, cells) @table, @cells = table, cells end |
Instance Method Details
#[](n) ⇒ Object
163 164 165 |
# File 'lib/cucumber/ast/table.rb', line 163 def [](n) @cells[n] end |
#accept(visitor, status) ⇒ Object
143 144 145 146 147 148 |
# File 'lib/cucumber/ast/table.rb', line 143 def accept(visitor, status) each do |cell| visitor.visit_table_cell(cell, status) end nil end |
#at_lines?(lines) ⇒ Boolean
171 172 173 |
# File 'lib/cucumber/ast/table.rb', line 171 def at_lines?(lines) lines.empty? || lines.index(line) end |
#line ⇒ Object
167 168 169 |
# File 'lib/cucumber/ast/table.rb', line 167 def line @cells[0].line end |
#to_hash ⇒ Object
:nodoc:
155 156 157 |
# File 'lib/cucumber/ast/table.rb', line 155 def to_hash #:nodoc: @to_hash ||= @table.to_hash(self) end |
#to_sexp ⇒ Object
For testing only
151 152 153 |
# File 'lib/cucumber/ast/table.rb', line 151 def to_sexp #:nodoc: [:row, *@cells.map{|cell| cell.to_sexp}] end |
#value(n) ⇒ Object
:nodoc:
159 160 161 |
# File 'lib/cucumber/ast/table.rb', line 159 def value(n) #:nodoc: self[n].value end |