Class: S41C::Sandbox
Overview
:nodoc
Instance Method Summary collapse
-
#eval_code ⇒ Object
:nodoc.
-
#initialize(ole, local_storage, dump) ⇒ Sandbox
constructor
:nodoc.
Methods included from Utils
Constructor Details
#initialize(ole, local_storage, dump) ⇒ Sandbox
:nodoc
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/s41c/sandbox.rb', line 10 def initialize(ole, local_storage, dump) @ole = ole @local_storage = local_storage dump.untaint hsh = Marshal.load(dump.unpack('m')[0]) @vars = hsh[:vars] @vars.each do |key, value| self.instance_variable_set(:"@#{key}", value) end @code = proc { $SAFE = 3 instance_eval hsh[:code], __FILE__, __LINE__ } end |
Instance Method Details
#eval_code ⇒ Object
:nodoc
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/s41c/sandbox.rb', line 29 def eval_code begin @code.call rescue WIN32OLERuntimeError => e "Error: #{to_utf8(e.)}" rescue Exception => e "Error Exception: #{e.}" rescue => e "Error: #{e.} from #{__FILE__}:#{__LINE__}" end end |