Class: FileProcessor
- Inherits:
-
Object
- Object
- FileProcessor
- Defined in:
- lib/rforward/file_processor.rb
Instance Attribute Summary collapse
-
#filepath ⇒ Object
Returns the value of attribute filepath.
-
#line_processor ⇒ Object
Returns the value of attribute line_processor.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(filepath, line_processor) ⇒ FileProcessor
constructor
A new instance of FileProcessor.
Constructor Details
#initialize(filepath, line_processor) ⇒ FileProcessor
Returns a new instance of FileProcessor.
4 5 6 |
# File 'lib/rforward/file_processor.rb', line 4 def initialize filepath, line_processor @filepath, @line_processor = filepath, line_processor end |
Instance Attribute Details
#filepath ⇒ Object
Returns the value of attribute filepath.
2 3 4 |
# File 'lib/rforward/file_processor.rb', line 2 def filepath @filepath end |
#line_processor ⇒ Object
Returns the value of attribute line_processor.
2 3 4 |
# File 'lib/rforward/file_processor.rb', line 2 def line_processor @line_processor end |
Class Method Details
.call(filepath) ⇒ Object
18 19 20 21 |
# File 'lib/rforward/file_processor.rb', line 18 def self.call filepath processor = FileProcessor.new filepath, FFluentdLine.new processor.call end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/rforward/file_processor.rb', line 8 def call RLogger.instance.info "start working on #{filepath}" File.readlines(filepath).each do |line| line_processor.call line end Stat.instance.files_current += 1 RLogger.instance.info "finish working on #{filepath}" RLogger.instance.stat end |