Sha256: 09771ceaffcf24fbdd8fe8bf82e3642ac58ea64bef38e479fdabff173c60941f
Contents?: true
Size: 750 Bytes
Versions: 10
Compression:
Stored size: 750 Bytes
Contents
module Prosperity class Aggregate::AggregateBuilder attr_reader :block def initialize(string = nil, &block) raise "Can't specify a string and a block" if string && block_given? @string = string @block = block end def build res = @string ? @string : instance_eval(&block) if res.is_a?(String) Aggregate::Sql.new(res) else res end end def count Aggregate::Count.new end def sum(column) Aggregate::Sum.new(column) end def maximum(column) Aggregate::Maximum.new(column) end def minimum(column) Aggregate::Minimum.new(column) end def average(column) Aggregate::Average.new(column) end end end
Version data entries
10 entries across 10 versions & 1 rubygems