class Prosperity::Aggregate::AggregateBuilder
Attributes
block[R]
Public Class Methods
new(string = nil, &block)
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 5 def initialize(string = nil, &block) raise "Can't specify a string and a block" if string && block_given? @string = string @block = block end
Public Instance Methods
average(column)
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 37 def average(column) Aggregate::Average.new(column) end
build()
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 12 def build res = @string ? @string : instance_eval(&block) if res.is_a?(String) Aggregate::Sql.new(res) else res end end
count()
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 21 def count Aggregate::Count.new end
maximum(column)
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 29 def maximum(column) Aggregate::Maximum.new(column) end
minimum(column)
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 33 def minimum(column) Aggregate::Minimum.new(column) end
sum(column)
click to toggle source
# File lib/prosperity/aggregate/aggregate_builder.rb, line 25 def sum(column) Aggregate::Sum.new(column) end