Module: FuncE

Defined in:
lib/func_e.rb,
lib/railtie.rb,
lib/func_e/func.rb,
lib/func_e/config.rb

Overview

Path: func_e/lib/func_e/config.rb

Defined Under Namespace

Classes: Config, Func, Railtie

Constant Summary collapse

RUNNER_PATH =
"#{File.expand_path(__dir__)}/func_e.js"

Class Method Summary collapse

Class Method Details

.exec(func) ⇒ Object



15
16
17
18
19
# File 'lib/func_e.rb', line 15

def self.exec(func)
  JSON.parse line.run(path: func.path, payload: func.serialize_payload), symbolize_names: true
rescue Terrapin::CommandLineError => e
  { error: 'An error occurred while executing the node function.', message: e.message }
end

.lineObject



21
22
23
# File 'lib/func_e.rb', line 21

def self.line
  Terrapin::CommandLine.new("node #{RUNNER_PATH}", '--path=:path --payload=:payload')
end