Sha256: c89a33278163bb5ded2d176515a359f9219b5752f4c93ff6009987b46689b133

Contents?: true

Size: 402 Bytes

Versions: 7

Compression:

Stored size: 402 Bytes

Contents

module Microscope
  class Scope
    class BooleanScope < Scope
      def apply
        model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
          scope "#{@field_name}", lambda { where("#{@field_name}" => true) }
          scope "not_#{@field_name}", lambda { where("#{@field_name}" => false) }
          scope "un#{@field_name}", lambda { not_#{@field_name} }
        RUBY
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
microscope-1.0.0 lib/microscope/scope/boolean_scope.rb
microscope-0.6.2 lib/microscope/scope/boolean_scope.rb
microscope-0.6.1 lib/microscope/scope/boolean_scope.rb
microscope-0.6 lib/microscope/scope/boolean_scope.rb
microscope-0.5.10 lib/microscope/scope/boolean_scope.rb
microscope-0.5.9 lib/microscope/scope/boolean_scope.rb
microscope-0.5.8 lib/microscope/scope/boolean_scope.rb