Skip to content

Instantly share code, notes, and snippets.

@jeffrydegrande
Created November 5, 2010 20:47
Show Gist options
  • Save jeffrydegrande/664841 to your computer and use it in GitHub Desktop.
Save jeffrydegrande/664841 to your computer and use it in GitHub Desktop.
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