Class: FileProcesser

Inherits:
FileProcesserInterface show all
Defined in:
lib/file_processer.rb

Instance Method Summary collapse

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