Skip to content

Instantly share code, notes, and snippets.

@adriand
Created February 16, 2010 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriand/305860 to your computer and use it in GitHub Desktop.
Save adriand/305860 to your computer and use it in GitHub Desktop.
# given hash like { :weeks => 1 } or { :months => -2 }, always return hash with a negative value
def past(interval)
k,v = interval.to_a[0]
interval[k] = v.abs * -1
interval
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment