module ExecJS::Xtrn::Rack

Constants

Formats

Public Class Methods

call(req) click to toggle source
# File lib/execjs/xtrn/routing.rb, line 20
def self.call req
  f=Formats[req['action_dispatch.request.path_parameters'][:format]] ||
    Formats['-']
  [
    200,
    {"Content-Type"=> f['mime']},
    [f['dump'].dump(stats)],
  ]
end
dump(s) click to toggle source

Dump as HTML

# File lib/execjs/xtrn/routing.rb, line 31
def self.dump s
  '<ul>'+
  s.map do |k, v|
    "<li><b>#{k}</b>#{Hash===v ? dump(v) : ": #{v}"}</li>"
  end
  .join('')+'</ul>'
end
stats() click to toggle source
# File lib/execjs/xtrn/routing.rb, line 16
def self.stats
  ExecJS::Xtrn.stats.as_json
end