Sha256: 4a7dd4f8e89efed5998697b1956bb74e37f9d1f88a743751f3ad12b7c842f60f

Contents?: true

Size: 513 Bytes

Versions: 8

Compression:

Stored size: 513 Bytes

Contents

module Searchgasm
  module Condition
    class Blank < Base
      self.value_type = :boolean
      
      class << self
        def condition_names_for_column
          super + ["is_blank"]
        end
      end
      
      def to_conditions(value)
        if value == true
          "#{column_sql} is NULL or #{column_sql} = '' or #{column_sql} = false"
        elsif value == false
          "#{column_sql} is NOT NULL and #{column_sql} != '' and #{column_sql} != false"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
searchgasm-1.3.4 lib/searchgasm/condition/blank.rb
searchgasm-1.3.3 lib/searchgasm/condition/blank.rb
searchgasm-1.4.0 lib/searchgasm/condition/blank.rb
searchgasm-1.5.1 lib/searchgasm/condition/blank.rb
searchgasm-1.4.1 lib/searchgasm/condition/blank.rb
searchgasm-1.3.5 lib/searchgasm/condition/blank.rb
searchgasm-1.5.2 lib/searchgasm/condition/blank.rb
searchgasm-1.5.0 lib/searchgasm/condition/blank.rb