lib/openwfe/util/safe.rb in openwferu-0.9.12 vs lib/openwfe/util/safe.rb in openwferu-0.9.12.863
- old
+ new
@@ -28,38 +28,35 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#++
#
-# $Id: utils.rb 3454 2006-10-08 16:51:00Z jmettraux $
-#
#
# "made in Japan"
#
# john.mettraux@openwfe.org
#
-#require 'tmpdir'
require 'open-uri'
module OpenWFE
- #
+ #--
# Runs some remote code (uri) at a different $SAFE level.
#
#def OpenWFE.load_safely (uri, safe_level)
# source = ""
# source << "#\n"
# source << "# loaded from #{uri}\n"
# source << "#\n"
# source << open(uri).read
# load_eval_safely(source, safe_level)
#end
-
#
+ #
# Makes sure that a piece of Ruby code is run at certain safe level.
# Saves in a temp file that is reloaded in its own anonymous namespace.
#
# (no binding passing allowed like in the basic Kernel.eval() method).
#
@@ -78,10 +75,11 @@
# File.delete tmpfname
# rescue Excpetion => e
# # ignore
# end
#end
+ #++
#
# Runs some code within an instance's realm at a certain safety level.
#
def OpenWFE.instance_eval_safely (instance, code, safe_level)
@@ -147,10 +145,15 @@
eval_safely(c, safe_level, binding)
end
protected
- def on_jruby?
+ #
+ # Returns true if the JRUBY_VERSION is defined.
+ # (beware : something else than JRuby may have defined it).
+ #
+ def OpenWFE.on_jruby?
+
defined?(JRUBY_VERSION) != nil
end
end