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.
215 216 217 |
# File 'lib/cucumber/ast/table.rb', line 215 def initialize(table, cells) @table, @cells = table, cells end |
Instance Method Details
#[](n) ⇒ Object
239 240 241 |
# File 'lib/cucumber/ast/table.rb', line 239 def [](n) @cells[n] end |
#accept(visitor, status) ⇒ Object
219 220 221 222 223 224 |
# File 'lib/cucumber/ast/table.rb', line 219 def accept(visitor, status) each do |cell| visitor.visit_table_cell(cell, status) end nil end |
#at_lines?(lines) ⇒ Boolean
247 248 249 |
# File 'lib/cucumber/ast/table.rb', line 247 def at_lines?(lines) lines.empty? || lines.index(line) end |
#line ⇒ Object
243 244 245 |
# File 'lib/cucumber/ast/table.rb', line 243 def line @cells[0].line end |
#to_hash ⇒ Object
:nodoc:
231 232 233 |
# File 'lib/cucumber/ast/table.rb', line 231 def to_hash #:nodoc: @to_hash ||= @table.to_hash(self) end |
#to_sexp ⇒ Object
For testing only
227 228 229 |
# File 'lib/cucumber/ast/table.rb', line 227 def to_sexp #:nodoc: [:row, *@cells.map{|cell| cell.to_sexp}] end |
#value(n) ⇒ Object
:nodoc:
235 236 237 |
# File 'lib/cucumber/ast/table.rb', line 235 def value(n) #:nodoc: self[n].value end |