mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-13 06:42:35 +00:00
21 lines
559 B
Ruby
21 lines
559 B
Ruby
# frozen_string_literal: true
|
|
|
|
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
|
|
self
|
|
end
|
|
end
|
|
end
|
|
end
|