Class: RunJS::SystemRuntime
- Defined in:
- lib/runjs/system_runtime.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.cmd ⇒ Object
Returns the value of attribute cmd.
Class Method Summary collapse
Instance Method Summary collapse
- #context(js) ⇒ Object
-
#initialize ⇒ SystemRuntime
constructor
A new instance of SystemRuntime.
- #run(js) ⇒ Object
Methods inherited from Runtime
#apply, #call, class_name, deprecated?, #eval
Methods included from Encoding
Constructor Details
#initialize ⇒ SystemRuntime
Returns a new instance of SystemRuntime.
13 14 15 |
# File 'lib/runjs/system_runtime.rb', line 13 def initialize @context = [] end |
Class Attribute Details
.cmd ⇒ Object
Returns the value of attribute cmd.
6 7 8 |
# File 'lib/runjs/system_runtime.rb', line 6 def cmd @cmd end |
Class Method Details
Instance Method Details
#context(js) ⇒ Object
17 18 19 20 |
# File 'lib/runjs/system_runtime.rb', line 17 def context(js) @context << encode(js, 'UTF-8') self end |
#run(js) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/runjs/system_runtime.rb', line 22 def run(js) js = encode(js, 'UTF-8') js = merge_context(js) js = merge_runner(js) result = popen(js) parse_json(result, js) end |