Sha256: 2c48a77ecf53dedb6e116a5c119ffc5d63ee95d54d1e2c41e6d93ce13e3cf5bd
Contents?: true
Size: 774 Bytes
Versions: 1
Compression:
Stored size: 774 Bytes
Contents
module ReportsKit module Reports module FilterTypes class Number < Base DEFAULT_CRITERIA = {} def apply_conditions(records) case criteria[:operator] when '>' records.where("#{column} > #{value.to_i}") when '>=' records.where("#{column} >= #{value.to_i}") when '<' records.where("#{column} < #{value.to_i}") when '<=' records.where("#{column} <= #{value.to_i}") when '=' records.where("#{column} = #{value.to_i}") else raise ArgumentError.new("Unsupported operator: '#{criteria[:operator]}'") end end def valid? value.present? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reports_kit-0.2.0 | lib/reports_kit/reports/filter_types/number.rb |