mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 08:02:36 +00:00
Cleanup i-mic-fps.rb a bit
This commit is contained in:
18
lib/ext/numeric.rb
Normal file
18
lib/ext/numeric.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
if RUBY_VERSION < "2.5.0"
|
||||
puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
||||
puts "|NOTICE| Ruby is #{RUBY_VERSION} not 2.5.0+..............................|Notice|"
|
||||
puts "|NOTICE| Monkey Patching Numeric to add required '.clamp' method.|Notice|"
|
||||
puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
||||
puts
|
||||
class Numeric
|
||||
def clamp(min, max)
|
||||
if self < min
|
||||
min
|
||||
elsif self > max
|
||||
max
|
||||
else
|
||||
return self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user