Skip to content

Instantly share code, notes, and snippets.

@mikesimons
Created September 17, 2010 12:50
Show Gist options
  • Save mikesimons/584180 to your computer and use it in GitHub Desktop.
Save mikesimons/584180 to your computer and use it in GitHub Desktop.
% irb
>> require "clamp.rb"
=> true
>> (0..360).clamp(370)
=> 360
>> (360..0).clamp(370)
=> 360
>> (360..0).clamp(-10)
=> 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment