Class: Spodunk::RowCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/spodunk/row_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_rows, _headers, tbl = nil) ⇒ RowCollection

Returns a new instance of RowCollection.



9
10
11
12
13
# File 'lib/spodunk/row_collection.rb', line 9

def initialize(_rows, _headers, tbl=nil)
  @table = tbl
  @headers = _headers
  @rows = spodunk_rows(_rows)
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/spodunk/row_collection.rb', line 6

def headers
  @headers
end

#rowsObject (readonly)

Returns the value of attribute rows.



6
7
8
# File 'lib/spodunk/row_collection.rb', line 6

def rows
  @rows
end

#tableObject (readonly)

Returns the value of attribute table.



6
7
8
# File 'lib/spodunk/row_collection.rb', line 6

def table
  @table
end

Instance Method Details

#spawn(_rows) ⇒ Object



16
17
18
# File 'lib/spodunk/row_collection.rb', line 16

def spawn(_rows)
  RowCollection.new(_rows, self.headers, self.table)
end

#where(&blk) ⇒ Object

not tested at all, obv



21
22
23
# File 'lib/spodunk/row_collection.rb', line 21

def where(&blk)
  spawn(@rows.select(&blk))
end