class Hashematics::Id
An ID is just like a Key
except its value is digested (hashed). The main rationale for this is ID's also contains user data, which could be unbound data, which could potentially consume lots of memory. To limit this, we digest it.
Public Class Methods
digest(val = '')
click to toggle source
This method is class-level to expose the underlying hashing algorithm used.
# File lib/hashematics/id.rb, line 17 def digest(val = '') # MD5 was chosen for its speed, it was not chosen for security. Digest::MD5.hexdigest(val) end
Private Instance Methods
make_value()
click to toggle source
# File lib/hashematics/id.rb, line 25 def make_value self.class.digest(parts.map(&:to_s).join(SEPARATOR)) end