Sha256: c781d2910c6d34dce18b4f7fb67b0e7cf8c68a9eef0ab908e64efd35079a7ec9

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

module Mongoid
  module Fields
    class Encrypted < Standard
      def demongoize(object)
        if object
          type.demongoize(Mongoid::Encrypted::Encryptor.decrypt(object))
        end
      end

      def encrypted?
        true
      end

      def mongoize(object)
        Mongoid::Encrypted::Encryptor.encrypt(object)
      end
    end
  end

  Fields.option(:encrypted) { |_model, _field, value| value }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-encrypted-1.0.0 lib/mongoid/fields/encrypted.rb