Sha256: de9544f6a5e8663f5c3af6fbc77417178b46f36efdd4e392a07109bb1ad97f2d
Contents?: true
Size: 817 Bytes
Versions: 9
Compression:
Stored size: 817 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...Float::INFINITY)) when '>=' records.where(column => (value.to_i..Float::INFINITY)) when '<' records.where(column => (-Float::INFINITY...value.to_i)) when '<=' records.where(column => (-Float::INFINITY..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
9 entries across 9 versions & 1 rubygems