Class: Spodunk::RowCollection
- Inherits:
-
Object
- Object
- Spodunk::RowCollection
- Includes:
- Enumerable
- Defined in:
- lib/spodunk/row_collection.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(_rows, _headers, tbl = nil) ⇒ RowCollection
constructor
A new instance of RowCollection.
- #spawn(_rows) ⇒ Object
-
#where(&blk) ⇒ Object
not tested at all, obv.
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
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/spodunk/row_collection.rb', line 6 def headers @headers end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
6 7 8 |
# File 'lib/spodunk/row_collection.rb', line 6 def rows @rows end |
#table ⇒ Object (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 |