Class: NodeRunner
- Inherits:
-
Object
- Object
- NodeRunner
- Defined in:
- lib/version.rb,
lib/node-runner.rb
Defined Under Namespace
Classes: Executor
Constant Summary collapse
- VERSION =
"1.0.1"
Instance Method Summary collapse
-
#initialize(source = "", options = {}) ⇒ NodeRunner
constructor
A new instance of NodeRunner.
- #method_missing(m, *args, &block) ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(source = "", options = {}) ⇒ NodeRunner
Returns a new instance of NodeRunner.
8 9 10 11 12 13 |
# File 'lib/node-runner.rb', line 8 def initialize(source = "", = {}) @source = encode(source.strip) @args = [:args] || {} @executor = [:executor] || NodeRunner::Executor.new @function_name = [:function_name] || "main" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/node-runner.rb', line 19 def method_missing(m, *args, &block) @function_name = m if block @source = encode(block.call.strip) end @args = *args exec end |
Instance Method Details
#output ⇒ Object
15 16 17 |
# File 'lib/node-runner.rb', line 15 def output exec end |