class SQLite3::Database

def define_aggregator( name, aggregator )

The functions arity is the arity of the +step+ method.
already provide a suitable +clone+.
individual instances of the aggregate function. Regular ruby objects
+aggregator+ object will serve as template that is cloned to provide the
_API Change:_ +aggregator+ must also implement +clone+. The provided

return value for the aggregator function.
+step+ will be called with row information and +finalize+ must return the
object +aggregator+. +aggregator+ must respond to +step+ and +finalize+.
Define an aggregate function named +name+ using a object template
def define_aggregator( name, aggregator )
  # Previously, this has been implemented in C. Now this is just yet
  # another compatibility shim
  proxy = Class.new do
    @template = aggregator
    @name = name
    def self.template
      @template
    end
    def self.name
      @name
    end
    def self.arity
      # this is what sqlite3_obj_method_arity did before
      @template.method(:step).arity
    end
    def initialize
      @klass = self.class.template.clone
    end
    def step(*args)
      @klass.step(*args)
    end
    def finalize
      @klass.finalize
    end
  end
  define_aggregator2(proxy, name)
  self
end