Class: StreamWrapper::GzipMultiFile
- Inherits:
-
Object
- Object
- StreamWrapper::GzipMultiFile
- Defined in:
- lib/logbox/stream_wrapper/gzip_multi_file.rb
Instance Method Summary collapse
- #close ⇒ Object
- #current_position ⇒ Object
- #debug=(bool) ⇒ Object
- #debug? ⇒ Boolean
- #eof? ⇒ Boolean
- #gets ⇒ Object
-
#initialize(paths = [], filters = {}) ⇒ GzipMultiFile
constructor
A new instance of GzipMultiFile.
Constructor Details
#initialize(paths = [], filters = {}) ⇒ GzipMultiFile
Returns a new instance of GzipMultiFile.
4 5 6 7 8 9 10 11 12 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 4 def initialize (paths = [], filters = {}) @paths = paths.is_a?(Array) ? paths.dup : [paths] @filters = filters if @paths.empty? @current_line = 0 @current_file = $stdin @current_path = '<stdin>' end end |
Instance Method Details
#close ⇒ Object
27 28 29 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 27 def close @current_file.close unless @current_file.nil? end |
#current_position ⇒ Object
31 32 33 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 31 def current_position "#{@current_path}:#{@current_line}" end |
#debug=(bool) ⇒ Object
35 36 37 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 35 def debug= (bool) @debug = bool end |
#debug? ⇒ Boolean
39 40 41 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 39 def debug? @debug end |
#eof? ⇒ Boolean
23 24 25 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 23 def eof? ! current_stream end |
#gets ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/logbox/stream_wrapper/gzip_multi_file.rb', line 14 def gets if file = current_stream @current_line += 1 file.gets else nil end end |