Module: Envjs

Defined in:
lib/envjs.rb

Defined Under Namespace

Modules: Net, Runtime Classes: TempFile

Constant Summary collapse

VERSION =
"0.3.8"
ENVJS =
File.expand_path( File.join( File.dirname(__FILE__),
"envjs",
"env.js" ) )
EVENT_LOOP =
File.expand_path( File.join( File.dirname(__FILE__),
"envjs",
"event_loop.js" ) )
STATIC =
File.expand_path( File.join( File.dirname(__FILE__),
"envjs",
"static.js" ) )

Class Method Summary collapse

Class Method Details

.js_exception_stack(e) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/envjs.rb', line 5

def self.js_exception_stack e
  result = %(Exception: )+e.to_s
  e.stack.to_s.split(%(\n)).each do |line|
    next if line == "@:0"
    m = line.match(/(.*)@([^@]*)$/)
    s = m[1]
    limit = 50
    if ( s.length > limit )
      s = s[0,limit] + %(...)
    end
    result += "\n" + m[2]+%( )+s
  end
  result
end