Sha256: d8f11d46f061816e18d1ac07c0b079dec966164040bab5f94deaef0915c88739

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 Bytes

Contents

require 'dm-types/paranoid/base'

module DataMapper
  class Property
    class ParanoidBoolean < Boolean
      default   false
      lazy      true

      # @api private
      def bind
        property_name = name.inspect

        model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
          include Paranoid::Base

          set_paranoid_property(#{property_name}) { true }

          default_scope(#{repository_name.inspect}).update(#{property_name} => false)
        RUBY
      end
    end # class ParanoidBoolean
  end # module Property
end # module DataMapper

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dm-types-1.0.0 lib/dm-types/paranoid_boolean.rb
dm-types-1.0.0.rc3 lib/dm-types/paranoid_boolean.rb
dm-types-1.0.0.rc2 lib/dm-types/paranoid_boolean.rb
dm-types-1.0.0.rc1 lib/dm-types/paranoid_boolean.rb