Sha256: 89c97c7f4d090884be216170eaa80385080490cff7af99cbfb08f051cd8043f2
Contents?: true
Size: 692 Bytes
Versions: 9
Compression:
Stored size: 692 Bytes
Contents
require 'dm-core' require 'bcrypt' module DataMapper class Property class BCryptHash < String length 60 def primitive?(value) value.kind_of?(BCrypt::Password) end def load(value) unless value.nil? begin primitive?(value) ? value : BCrypt::Password.new(value) rescue BCrypt::Errors::InvalidHash BCrypt::Password.create(value, :cost => BCrypt::Engine::DEFAULT_COST) end end end def dump(value) load(value) end def typecast_to_primitive(value) load(value) end end # class BCryptHash end # class Property end # module DataMapper
Version data entries
9 entries across 9 versions & 2 rubygems