Class: MyPipe
- Inherits:
-
Object
- Object
- MyPipe
- Defined in:
- lib/rest_debug/pipes.rb
Instance Attribute Summary collapse
-
#pipe ⇒ Object
Returns the value of attribute pipe.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(pipe) ⇒ MyPipe
constructor
A new instance of MyPipe.
- #open? ⇒ Boolean
- #pid ⇒ Object
- #read ⇒ Object
- #read_all ⇒ Object
- #write(*args) ⇒ Object
Constructor Details
#initialize(pipe) ⇒ MyPipe
Returns a new instance of MyPipe.
24 25 26 |
# File 'lib/rest_debug/pipes.rb', line 24 def initialize(pipe) @pipe = pipe end |
Instance Attribute Details
#pipe ⇒ Object
Returns the value of attribute pipe.
23 24 25 |
# File 'lib/rest_debug/pipes.rb', line 23 def pipe @pipe end |
Instance Method Details
#close ⇒ Object
52 53 54 55 |
# File 'lib/rest_debug/pipes.rb', line 52 def close read pipe.close end |
#closed? ⇒ Boolean
35 36 37 |
# File 'lib/rest_debug/pipes.rb', line 35 def closed? read_cache =~ /#{done_str}/ end |
#open? ⇒ Boolean
38 39 40 |
# File 'lib/rest_debug/pipes.rb', line 38 def open? !closed? end |
#pid ⇒ Object
56 57 58 |
# File 'lib/rest_debug/pipes.rb', line 56 def pid pipe.pid end |
#read ⇒ Object
30 31 32 33 34 |
# File 'lib/rest_debug/pipes.rb', line 30 def read res = pipe.read_available self.read_cache << res res.gsub(done_str,"") end |
#read_all ⇒ Object
42 43 44 45 46 47 |
# File 'lib/rest_debug/pipes.rb', line 42 def read_all read res = read_cache res << "\n(CLOSED)" if closed? res end |
#write(*args) ⇒ Object
49 50 51 |
# File 'lib/rest_debug/pipes.rb', line 49 def write(*args) pipe.write(*args) end |