Module: Kernel

Defined in:
lib/interfacets/mruby/entrypoint.rb

Instance Method Summary collapse

Instance Method Details

#wrapped_call(json_string) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/interfacets/mruby/entrypoint.rb', line 12

def wrapped_call(json_string)
  spec = JSON.parse(json_string)
  eval(spec.fetch("receiver")).send(
    spec.fetch("method"),
    *spec.fetch("args", []),
  )
rescue StandardError, SyntaxError => e
  $stderr.puts(e.class)
  $stderr.puts(e.message)
  $stderr.puts(e.backtrace.join("\n"))
end

#wrapped_eval(str, path) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/interfacets/mruby/entrypoint.rb', line 4

def wrapped_eval(str, path)
  eval(str, binding, path)
rescue StandardError, SyntaxError => e
  $stderr.puts(e.class)
  $stderr.puts(e.message)
  $stderr.puts(e.backtrace.join("\n"))
end