Sha256: f501131b6cb551ac5ac4a491f26ef9316417875880e5c1c089dbe194ce54ca34
Contents?: true
Size: 687 Bytes
Versions: 4
Compression:
Stored size: 687 Bytes
Contents
module ReportsKit module Reports module FilterTypes class Boolean < Base DEFAULT_CRITERIA = { operator: nil } def apply_conditions(records) case criteria[:operator] when true, 'true' records.where("(#{column}) = true") when false, 'false' records.where("(#{column}) != true") else raise ArgumentError.new("Unsupported operator: '#{criteria[:operator]}'") end end def valid? criteria[:operator].present? end def column settings[:conditions] || properties[:key] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems