mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Added monkey patch to support rubies < 2.5
This commit is contained in:
19
i-mic-fps.rb
19
i-mic-fps.rb
@@ -20,6 +20,25 @@ end
|
||||
|
||||
BoundingBox = Struct.new(:min_x, :min_y, :min_z, :max_x, :max_y, :max_z)
|
||||
|
||||
if RUBY_VERSION < "2.5.0"
|
||||
puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
||||
puts "|NOTICE| Ruby is #{RUBY_VERSION} not 2.5.0+..............................|Notice|"
|
||||
puts "|NOTICE| Monkey Patching Float to add required '.clamp' method.|Notice|"
|
||||
puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
||||
puts
|
||||
class Float
|
||||
def clamp(min, max)
|
||||
if self < min
|
||||
min
|
||||
elsif self > max
|
||||
max
|
||||
else
|
||||
return self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
$debug = ARGV.join.include?("--debug") ? true : false
|
||||
|
||||
require_relative "lib/common_methods"
|
||||
|
||||
Reference in New Issue
Block a user