Skip to content

Instantly share code, notes, and snippets.

@vpacher
Forked from lenary/lookup_by_range.rb
Created August 19, 2011 18:51
Show Gist options
  • Select an option

  • Save vpacher/1157666 to your computer and use it in GitHub Desktop.

Select an option

Save vpacher/1157666 to your computer and use it in GitHub Desktop.
class Hash
def lookup_by_range(num)
self.find {|range, v| range.include?(num) }.last
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment