Class: Pleeease::NodeRunner
- Inherits:
-
Struct
- Object
- Struct
- Pleeease::NodeRunner
- Defined in:
- lib/pleeease/runner.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#script ⇒ Object
Returns the value of attribute script.
Instance Method Summary collapse
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment
3 4 5 |
# File 'lib/pleeease/runner.rb', line 3 def environment @environment end |
#script ⇒ Object
Returns the value of attribute script
3 4 5 |
# File 'lib/pleeease/runner.rb', line 3 def script @script end |
Instance Method Details
#cmd ⇒ Object
20 21 22 |
# File 'lib/pleeease/runner.rb', line 20 def cmd [ 'node', '-e', script ] end |
#env ⇒ Object
16 17 18 |
# File 'lib/pleeease/runner.rb', line 16 def env environment || ENV end |
#run ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/pleeease/runner.rb', line 4 def run IO.popen(env, cmd, "r+") do |f| # pump stdout lines = [] f.each do |line| lines << line end lines.join end end |