Class: GemMonitor::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_monitor/reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Reader

Returns a new instance of Reader.



6
7
8
# File 'lib/gem_monitor/reader.rb', line 6

def initialize args = {}
  self.file_path = args.fetch(:file_path, nil)
end

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



4
5
6
# File 'lib/gem_monitor/reader.rb', line 4

def file_path
  @file_path
end

Instance Method Details

#readObject



10
11
12
13
14
15
16
# File 'lib/gem_monitor/reader.rb', line 10

def read
  begin
    File.read file_path
  rescue => e
    raise GemMonitor::Error.new("Could not find file #{file_path}.")
  end
end