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



13
14
15
16
17
# File 'lib/func_e.rb', line 13

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



19
20
21
# File 'lib/func_e.rb', line 19

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