Sha256: 994d4c017a16ae51a65cb24e22ff24722765d0402870e6f465d25b52e50266bb
Contents?: true
Size: 573 Bytes
Versions: 9
Compression:
Stored size: 573 Bytes
Contents
class Hash # creates a uniq sha1 digest of the hash's values # should mirror similar code in OneBody's lib/db_tools.rb def values_hash(*attrs) attrs = keys.sort unless attrs.any? attrs = attrs.first if attrs.first.is_a?(Array) values = attrs.map do |attr| value = self[attr.to_s] if value.respond_to?(:strftime) value.strftime('%Y-%m-%d %H:%M:%S') elsif value == true 1 elsif value == false 0 else value end end DEBUG ? values.join : Digest::SHA1.hexdigest(values.join) end end
Version data entries
9 entries across 9 versions & 1 rubygems