Class SQLSerializableList
In: sql-list.rb
Parent: Object

An (almost) enumerable list of serializable objects. All the usual methods of enumerable objects apply except sort which remains unimplemented (as a side effect of <=> not being implemented), even min and max has been implemented.

Methods
[]    each    each_with_index    max    min    new   
Included modules
Enumerable
Public Class methods
new(classname, dbi)

initialize with the class name and a connected dbi. This will make sure that we hold on to the dbi (which must remain valid for any call to succeed)

Public Instance methods
[](key)

Fetch an object in the given table (same as class name), with key as primary key.

each_with_index(&block) {|obj, index| ...}

Fetch each value (with or without index).The each is almost a nop after implementing each_with_index. The index will be the primary key of the object in question.

each(&block) {|obj| ...}
min()

Select the object with the smallest primary key value, min does not accept a block as min usually do.

This method expects that the database connected to implements the MIN() function.

max()

Select the object with the largest primary key value, max does not accept a block as max usually do.

This method expects that the database connected to implements the MAX() function.