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

@@ -1,13 +1,10 @@
GEM
remote: https://rubygems.org/
specs:
chunky_png (1.3.10)
glu (8.2.2)
glu (8.2.2-x86-mingw32)
glu (8.3.0)
glu (8.3.0-x86-mingw32)
gosu (0.13.3)
gosu (0.13.3-x86-mingw32)
oily_png (1.2.1)
chunky_png (~> 1.3.7)
opengl-bindings (1.6.6)
PLATFORMS
@@ -17,8 +14,7 @@ PLATFORMS
DEPENDENCIES
glu
gosu
oily_png
opengl-bindings
BUNDLED WITH
1.16.1
1.16.2

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"