Class: GemMonitor::Reader
- Inherits:
-
Object
- Object
- GemMonitor::Reader
- Defined in:
- lib/gem_monitor/reader.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
Returns the value of attribute file_path.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Reader
constructor
A new instance of Reader.
- #read ⇒ Object
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_path ⇒ Object
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
#read ⇒ Object
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 |