Added monkey patch to support rubies < 2.5

This commit is contained in:
2018-06-18 11:47:44 -05:00
parent aff4c8b545
commit 8f39c34d54
2 changed files with 22 additions and 7 deletions

View File

@@ -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"