Sha256: 03117de45b405058efac841f9e1b29257c39be1787b9def5ca7525f486f69d15
Contents?: true
Size: 874 Bytes
Versions: 19
Compression:
Stored size: 874 Bytes
Contents
module Kernel def silently(&blk) old_verbose, $VERBOSE = $VERBOSE, nil yield $VERBOSE = old_verbose end end class Module def undef_methods(*methods) methods.each { |name| undef_method(name) } end end class Object def to_jail Safemode.jail self end end # As every call to an object in the eval'ed string will be jailed by the # parser we don't need to "proactively" jail arrays and hashes. Likewise we # don't need to jail objects returned from a jail. Doing so would provide # "double" protection, but it also would break using a return value in an if # statement, passing them to a Rails helper etc. # class Array # def to_jail # Safemode.jail collect{ |obj| obj.to_jail } # end # end # # class Hash # def to_jail # hash = {} # collect{ |key, obj| hash[key] = obj.to_jail} # Safemode.jail hash # end # end
Version data entries
19 entries across 19 versions & 1 rubygems