Created
November 5, 2010 20:47
-
-
Save jeffrydegrande/664841 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ATTRIBUTES_ORDERED_FOR_CREATING_GUIDS = [:guid, :url, :content, :summary] | |
def self.guid_from_entry(entry) | |
def entry.can_make_guid_with?(symbol) | |
respond_to?(symbol) && send(symbol).present? | |
end | |
def entry.make_guid_from(symbol) | |
Digest::MD5.hexdigest(send(symbol)) | |
end | |
ATTRIBUTES_ORDERED_FOR_CREATING_GUIDS.each do |symbol| | |
entry.make_guid_from(symbol) if entry.can_make_guid_with?(symbol) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment