class Mongoid::EncryptedHash
Public Class Methods
convert(object)
click to toggle source
Takes an object representation (Hash or string) and converts it to an EncryptedHash
.
# File lib/mongoid-encrypted-fields/fields/encrypted_hash.rb, line 39 def convert(object) case object when Hash from_hash(object) else from_hash(::YAML.load(object)) end end
from_hash(h)
click to toggle source
converts from a plain Hash to an EncryptedHash
# File lib/mongoid-encrypted-fields/fields/encrypted_hash.rb, line 33 def from_hash(h) self[h.to_hash] end
Public Instance Methods
raw_value()
click to toggle source
Return value to be encrypted
# File lib/mongoid-encrypted-fields/fields/encrypted_hash.rb, line 26 def raw_value stringify_keys.to_yaml end