Class: Cucumber::Ast::Table::Cells

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/cucumber/ast/table.rb

Overview

Represents a row of cells or columns of cells

Instance Method Summary collapse

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

Returns:

  • (Boolean)


171
172
173
# File 'lib/cucumber/ast/table.rb', line 171

def at_lines?(lines)
  lines.empty? || lines.index(line)
end

#lineObject



167
168
169
# File 'lib/cucumber/ast/table.rb', line 167

def line
  @cells[0].line
end

#to_hashObject

:nodoc:



155
156
157
# File 'lib/cucumber/ast/table.rb', line 155

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

#to_sexpObject

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