Class: DiffRunner::Invocation
- Inherits:
-
Object
- Object
- DiffRunner::Invocation
- Defined in:
- lib/diff-runner/invocation.rb
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
-
#initialize(cmd) ⇒ Invocation
constructor
A new instance of Invocation.
- #output ⇒ Object
- #present(message) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(cmd) ⇒ Invocation
Returns a new instance of Invocation.
6 7 8 |
# File 'lib/diff-runner/invocation.rb', line 6 def initialize(cmd) @cmd = cmd end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
4 5 6 |
# File 'lib/diff-runner/invocation.rb', line 4 def pid @pid end |
Instance Method Details
#output ⇒ Object
17 18 19 20 21 |
# File 'lib/diff-runner/invocation.rb', line 17 def output IO.popen(@cmd) do |io| io.read end end |
#present(message) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/diff-runner/invocation.rb', line 23 def present() if @pid Process.kill("QUIT", @pid) rescue nil end IO.popen("less", "w") do |io| io.puts @pid = io.pid end end |
#run ⇒ Object
10 11 12 13 14 15 |
# File 'lib/diff-runner/invocation.rb', line 10 def run Thread.new do puts `clear` present output end end |