Method: RScript#run
- Defined in:
- lib/rscript.rb
#run(raw_args, params = {}, rws = nil) ⇒ Object
note: run() was copied from the development file rscript-wrapper.rb
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/rscript.rb', line 75 def run(raw_args, params={}, rws=nil) if params[:splat] then params.each do |k,v| params.delete k unless k == :splat or k == :package or k == :job or k == :captures end end if params[:splat] and params[:splat].length > 0 then h = params[:splat].first[1..-1].split('&').inject({}) do |r,x| k, v = x.split('=') v ? r.merge(k[/\w+$/].to_sym => v) : r end params.merge! h end code2, args = self.read raw_args begin xthread = @xthreads.create_thread('thread' + @id.to_s) { eval code2} xthread.start @id += 1 r = xthread.result params = {} return r rescue Exception => e params = {} err_label = e..to_s + " :: \n" + e.backtrace.join("\n") return err_label end end |