Class: FileProcesser
- Inherits:
-
FileProcesserInterface
- Object
- FileProcesserInterface
- FileProcesser
- Defined in:
- lib/file_processer.rb
Instance Method Summary collapse
-
#initialize(processFunc) ⇒ FileProcesser
constructor
A new instance of FileProcesser.
- #process(filePath) ⇒ Object
Constructor Details
#initialize(processFunc) ⇒ FileProcesser
Returns a new instance of FileProcesser.
21 22 23 |
# File 'lib/file_processer.rb', line 21 def initialize(processFunc) @processFunc = processFunc end |
Instance Method Details
#process(filePath) ⇒ Object
25 26 27 28 29 |
# File 'lib/file_processer.rb', line 25 def process(filePath) fileContent = File.read(filePath) result = @processFunc.call(fileContent) File.write(filePath, result) end |