Sha256: befb61aff4eb5f26be8113fee57d5f2b3af68da689e1286cb954d02e3bffae40

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

if defined?(DataMapper)
  module Huberry
    module AttrEncrypted
      module Adapters
        module DataMapper
          def self.included(base)
            base.extend ClassMethods
          end
        
          module ClassMethods
            protected
              # Calls attr_encrypted with the options <tt>:encode</tt> and <tt>:marshal</tt> set to true
              # unless they've already been specified
              def attr_encrypted(*attrs)
                options = { :encode => true, :marshal => true }.merge(attrs.last.is_a?(Hash) ? attrs.pop : {})
                super *(attrs << options)
              end
          end
        end
      end
    end
  end
  
  DataMapper::Resource.send :include, Huberry::AttrEncrypted::Adapters::DataMapper
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shuber-attr_encrypted-1.0.4 lib/huberry/attr_encrypted/adapters/data_mapper.rb
shuber-attr_encrypted-1.0.5 lib/huberry/attr_encrypted/adapters/data_mapper.rb