Created
February 22, 2013 15:42
-
-
Save cilquirm/5014302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.guid = Digest::SHA2.new.tap do |d| | |
d << (self.name || "NULL") | |
d << (self.key || "NULL") | |
d << (self.infogroup_id || "NULL") | |
d << (self.street || "NULL") | |
d << (self.city || "NULL" ) | |
d << (self.state || "NULL") | |
end |
Digest::SHA2.hexdigest attributes.values_at('name', 'key', 'infogroup_id', 'street', 'city', 'state').to_json
Eric's answer is more complete. What I pasted is what we do in place_directory, which you'll see in a few files called identity.rb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about: