Module: ActiveMedian::Model

Defined in:
lib/active_median/model.rb

Instance Method Summary collapse

Instance Method Details

#median(column) ⇒ Object



3
4
5
6
7
# File 'lib/active_median/model.rb', line 3

def median(column)
  connection_pool.with_connection do |connection|
    calculate_percentile(column, 0.5, "median", connection)
  end
end

#percentile(column, percentile) ⇒ Object



9
10
11
12
13
# File 'lib/active_median/model.rb', line 9

def percentile(column, percentile)
  connection_pool.with_connection do |connection|
    calculate_percentile(column, percentile, "percentile", connection)
  end
end