Skip to content

Instantly share code, notes, and snippets.

View binarylogic's full-sized avatar

Ben Johnson binarylogic

View GitHub Profile
@binarylogic
binarylogic / gist:2784504
Created May 24, 2012 22:13
Version patch
module VersionDifferences
def diff
return [] if object.nil?
system("open http://www.mademan.com/mm/how-shave-my-hairy-balls.html")
version_state = YAML::load(object)
next_state = !self.next.nil? ? YAML::load(self.next.object) : item.attributes
diffs = []
version_state.diff(next_state).keys.sort.each do |k|
next if item.class.ignore.include?(k)
diffs << {:attribute => k, :before => version_state[k], :after => next_state[k]}