class Spodunk::RowCollection

Attributes

headers[R]
rows[R]
table[R]

Public Class Methods

new(_rows, _headers, tbl=nil) click to toggle source
# File lib/spodunk/row_collection.rb, line 9
def initialize(_rows, _headers, tbl=nil)
  @table = tbl
  @headers = _headers
  @rows = spodunk_rows(_rows)
end

Public Instance Methods

spawn(_rows) click to toggle source
# File lib/spodunk/row_collection.rb, line 16
def spawn(_rows)
  RowCollection.new(_rows, self.headers, self.table)
end
where(&blk) click to toggle source

not tested at all, obv

# File lib/spodunk/row_collection.rb, line 21
def where(&blk)
  spawn(@rows.select(&blk))
end

Private Instance Methods

spodunk_rows(rts) click to toggle source
# File lib/spodunk/row_collection.rb, line 27
def spodunk_rows(rts)
  rts.map{ |r| r.is_a?(Spodunk::Row) ? r : Spodunk::Row.new(r, @headers, table: @table)}
end