Class: CaptiveStackDetector::LocalFileReader

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/captive_stack_detector/file_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ LocalFileReader

Returns a new instance of LocalFileReader.



22
23
24
25
# File 'lib/captive_stack_detector/file_reader.rb', line 22

def initialize(path)
  @path   = path
  @parser = FileContentParser.new(self)
end

Instance Method Details

#read(filename) ⇒ Object



27
28
29
30
# File 'lib/captive_stack_detector/file_reader.rb', line 27

def read(filename)
  full = File.join(@path, filename)
  File.read(full, encoding: "utf-8") if File.exist?(full)
end