class FlatKit::StatType::OrdinalStats
Same as NominalStats
and also collects min and max
Attributes
max[R]
min[R]
Public Class Methods
all_stats()
click to toggle source
# File lib/flat_kit/stat_type/ordinal_stats.rb, line 14 def self.all_stats @all_stats ||= %w[ count max min unique_count unique_values mode ] end
default_stats()
click to toggle source
# File lib/flat_kit/stat_type/ordinal_stats.rb, line 10 def self.default_stats @default_stats ||= %w[ count max min ] end
new(collecting_frequencies: false)
click to toggle source
Calls superclass method
FlatKit::StatType::NominalStats::new
# File lib/flat_kit/stat_type/ordinal_stats.rb, line 18 def initialize(collecting_frequencies: false) super @min = nil @max = nil end
Public Instance Methods
update(value)
click to toggle source
# File lib/flat_kit/stat_type/ordinal_stats.rb, line 24 def update(value) @mutex.synchronize do if @min.nil? || (value < @min) then @min = value end if @max.nil? || (value > @max) then @max = value end @count += 1 @frequencies[value] += 1 if @collecting_frequencies end end