Module: RIO::Filter::CloseOnEOF
- Defined in:
- lib/rio/filter/closeoneof.rb
Instance Attribute Summary collapse
-
#autoclosed ⇒ Object
Returns the value of attribute autoclosed.
-
#oncloseproc ⇒ Object
Returns the value of attribute oncloseproc.
Class Method Summary collapse
Instance Method Summary collapse
- #autoclosed? ⇒ Boolean
-
#close_on_eof(&block) ⇒ Object
end.
- #close_on_eof1(&block) ⇒ Object
- #close_on_eof_(rtn) ⇒ Object
- #contents ⇒ Object
- #copy_stream(dst) ⇒ Object
- #each_byte(*args, &block) ⇒ Object
- #each_bytes(nb, *args, &block) ⇒ Object
- #each_line(*args, &block) ⇒ Object
- #gets(*args) ⇒ Object
- #read(*args) ⇒ Object
- #readchar(*args) ⇒ Object
- #readline(*args) ⇒ Object
- #readlines(*args) ⇒ Object
Instance Attribute Details
#autoclosed ⇒ Object
Returns the value of attribute autoclosed.
41 42 43 |
# File 'lib/rio/filter/closeoneof.rb', line 41 def autoclosed @autoclosed end |
#oncloseproc ⇒ Object
Returns the value of attribute oncloseproc.
40 41 42 |
# File 'lib/rio/filter/closeoneof.rb', line 40 def oncloseproc @oncloseproc end |
Class Method Details
.extend_object(ioh) ⇒ Object
42 43 44 45 46 |
# File 'lib/rio/filter/closeoneof.rb', line 42 def self.extend_object(ioh) super ioh.autoclosed = false ioh.oncloseproc = nil end |
Instance Method Details
#autoclosed? ⇒ Boolean
47 48 49 |
# File 'lib/rio/filter/closeoneof.rb', line 47 def autoclosed? @autoclosed end |
#close_on_eof(&block) ⇒ Object
end
59 60 61 62 63 64 65 66 |
# File 'lib/rio/filter/closeoneof.rb', line 59 def close_on_eof(&block) #p callstr('close_on_eof',rtn) rtn = yield if handle.eof? close_on_eof_(rtn) end rtn end |
#close_on_eof1(&block) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/rio/filter/closeoneof.rb', line 67 def close_on_eof1(&block) #p callstr('close_on_eof',rtn) if handle.eof? close_on_eof_(nil) yield else yield end end |
#close_on_eof_(rtn) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/rio/filter/closeoneof.rb', line 76 def close_on_eof_(rtn) #p callstr('close_on_eof_',rtn) unless @autoclosed or closed? #handle.close() @oncloseproc.call() unless @oncloseproc.nil? @autoclosed = true end rtn end |
#contents ⇒ Object
99 |
# File 'lib/rio/filter/closeoneof.rb', line 99 def contents() close_on_eof{super} end |
#copy_stream(dst) ⇒ Object
98 |
# File 'lib/rio/filter/closeoneof.rb', line 98 def copy_stream(dst) close_on_eof{super} end |
#each_byte(*args, &block) ⇒ Object
87 |
# File 'lib/rio/filter/closeoneof.rb', line 87 def each_byte(*args,&block) close_on_eof{super} end |
#each_bytes(nb, *args, &block) ⇒ Object
88 |
# File 'lib/rio/filter/closeoneof.rb', line 88 def each_bytes(nb,*args,&block) close_on_eof{super} end |
#each_line(*args, &block) ⇒ Object
86 |
# File 'lib/rio/filter/closeoneof.rb', line 86 def each_line(*args,&block) close_on_eof{super} end |
#gets(*args) ⇒ Object
93 |
# File 'lib/rio/filter/closeoneof.rb', line 93 def gets(*args) close_on_eof{super} end |
#read(*args) ⇒ Object
96 |
# File 'lib/rio/filter/closeoneof.rb', line 96 def read(*args) close_on_eof{super} end |
#readchar(*args) ⇒ Object
92 |
# File 'lib/rio/filter/closeoneof.rb', line 92 def readchar(*args) close_on_eof{super} end |
#readline(*args) ⇒ Object
90 |
# File 'lib/rio/filter/closeoneof.rb', line 90 def readline(*args) close_on_eof{super} end |
#readlines(*args) ⇒ Object
94 |
# File 'lib/rio/filter/closeoneof.rb', line 94 def readlines(*args) close_on_eof{super} end |