Class: GreenPepper::Table
- Inherits:
-
Object
- Object
- GreenPepper::Table
- Defined in:
- lib/greenpepper/parser/table.rb
Instance Method Summary collapse
- #==(rho) ⇒ Object
- #[](row) ⇒ Object
- #each_row ⇒ Object
-
#initialize ⇒ Table
constructor
A new instance of Table.
- #merge_with(to_merge) ⇒ Object
- #push_row(row) ⇒ Object
Constructor Details
#initialize ⇒ Table
Returns a new instance of Table.
8 9 10 |
# File 'lib/greenpepper/parser/table.rb', line 8 def initialize @table = Array.new end |
Instance Method Details
#==(rho) ⇒ Object
25 26 27 28 |
# File 'lib/greenpepper/parser/table.rb', line 25 def ==(rho) return false unless rho.is_a? Table @table == rho.table end |
#[](row) ⇒ Object
12 13 14 |
# File 'lib/greenpepper/parser/table.rb', line 12 def [](row) @table[row] end |
#each_row ⇒ Object
30 31 32 |
# File 'lib/greenpepper/parser/table.rb', line 30 def each_row @table.each{|row| yield row } end |
#merge_with(to_merge) ⇒ Object
20 21 22 23 |
# File 'lib/greenpepper/parser/table.rb', line 20 def merge_with(to_merge) @table = @table + to_merge.table self end |
#push_row(row) ⇒ Object
16 17 18 |
# File 'lib/greenpepper/parser/table.rb', line 16 def push_row(row) @table.push row.clone end |