diff options
Diffstat (limited to 'lib/chef/monkey_patches/numeric.rb')
-rw-r--r-- | lib/chef/monkey_patches/numeric.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/monkey_patches/numeric.rb b/lib/chef/monkey_patches/numeric.rb new file mode 100644 index 0000000000..1f5ff14209 --- /dev/null +++ b/lib/chef/monkey_patches/numeric.rb @@ -0,0 +1,15 @@ +unless 0.respond_to?(:fdiv) + class Numeric + def fdiv(other) + to_f / other + end + end +end + +# String elements referenced with [] <= 1.8.6 return a Fixnum. Cheat to allow +# for the simpler "test"[2].ord construct +class Numeric + def ord + return self + end +end |