Sha256: b0ca1190f5c06dff01827308b9f18245164093ef37cbb237af364c8eb81c673f

Contents?: true

Size: 382 Bytes

Versions: 5

Compression:

Stored size: 382 Bytes

Contents

class Dorsale::SmallData::FilterStrategyByKeyValue < ::Dorsale::SmallData::FilterStrategy
  attr_reader :key

  def initialize(key = nil)
    @key = key
  end

  def apply(query, value)
    value = true  if value == "true"
    value = false if value == "false"
    value = nil   if value == "nil"
    value = nil   if value == "null"

    query.where("#{key} = ?", value)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dorsale-3.4.0 app/filters/dorsale/small_data/filter_strategy_by_key_value.rb
dorsale-3.3.0 app/filters/dorsale/small_data/filter_strategy_by_key_value.rb
dorsale-3.2.0 app/filters/dorsale/small_data/filter_strategy_by_key_value.rb
dorsale-3.1.7 app/filters/dorsale/small_data/filter_strategy_by_key_value.rb
dorsale-3.1.6 app/filters/dorsale/small_data/filter_strategy_by_key_value.rb