Sha256: 1a3a97333aa7a03c401299d2fcdd3894c0a239cbf9c3d3274b32f7c6fb2c388c

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

module Huberry
  module DataMapper
    def self.included(base)
      base.class_eval do
        extend ClassMethods
        alias_method :read_attribute, :attribute_get
        alias_method :write_attribute, :attribute_set
      end
    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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shuber-attr_encrypted-1.0.1 lib/huberry/data_mapper.rb
shuber-attr_encrypted-1.0.2 lib/huberry/data_mapper.rb