Sha256: 1cc758d9098a86f0d0a94f372d1b9fd13b28b5bf60b845f08d19be261947d5c6

Contents?: true

Size: 434 Bytes

Versions: 16

Compression:

Stored size: 434 Bytes

Contents

# Alternate "safer" versions of Ruby methods. Mostly non-blocking.
[Fixnum, Bignum, Float].each do |klass|
  klass.class_eval do
    # A very weak version of pow, it doesn't work on Floats, but it's gonna
    # fill the most common uses for now.
    def **(x)
      case x
      when 0; 1
      when 1; self
      else
        y = 1
        while 0 <= (x -= 1) do
          y *= self
        end
        y
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
xplenty-jruby_sandbox-0.2.9-java lib/sandbox/prelude.rb
xplenty-jruby_sandbox-0.2.8-java lib/sandbox/prelude.rb
xplenty-jruby_sandbox-0.2.7-java lib/sandbox/prelude.rb
xplenty-jruby_sandbox-0.2.6-java lib/sandbox/prelude.rb
xplenty-jruby_sandbox-0.2.5-java lib/sandbox/prelude.rb
xplenty-jruby_sandbox-0.2.4-java lib/sandbox/prelude.rb
jruby_sandbox-0.2.3-java lib/sandbox/prelude.rb
jruby-safe-0.2.2-java lib/sandbox/prelude.rb
jruby_sandbox-0.2.2-java lib/sandbox/prelude.rb
jruby_sandbox-0.2.1-java lib/sandbox/prelude.rb
jruby_sandbox-0.2.0-java lib/sandbox/prelude.rb
jruby_sandbox-0.1.4-java lib/sandbox/prelude.rb
jruby_sandbox-0.1.3-java lib/sandbox/prelude.rb
jruby_sandbox-0.1.2-java lib/sandbox/prelude.rb
jruby_sandbox-0.1.1-java lib/sandbox/prelude.rb
jruby_sandbox-0.1.0-java lib/sandbox/prelude.rb