Sha256: d24e58afdf464b3218bed85a8f58c671fb722e38e638745ba7e4788807f0d477
Contents?: true
Size: 1.11 KB
Versions: 6
Compression:
Stored size: 1.11 KB
Contents
module Influxer module Calculations #:nodoc: CALCULATION_METHODS = [ :count, :min, :max, :mean, :mode, :median, :distinct, :derivative, :stddev, :sum, :first, :last ].freeze CALCULATION_METHODS.each do |name| class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name}(val, alias_name = nil) # def count(val) @values[:has_calculations] = true # @values[:has_calculations] = true select_values << "#{name}(\#\{val\})\#\{alias_name ? ' as '+alias_name.to_s : ''\}" # select_values << "count(\#\{val\})" self # self end # end CODE end def percentile(name, val, alias_name = nil) @values[:has_calculations] = true select_values << "percentile(#{name}, #{val})#{alias_name ? ' as ' + alias_name.to_s : ''}" self end end end
Version data entries
6 entries across 6 versions & 1 rubygems