Class: Pears::Provider::LocalFile
- Defined in:
- lib/pears/provider/local_file.rb
Overview
Used for loading simple YAML file locally.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(file_path, on_failure: :raise) ⇒ LocalFile
constructor
A new instance of LocalFile.
Methods inherited from Base
Constructor Details
#initialize(file_path, on_failure: :raise) ⇒ LocalFile
Returns a new instance of LocalFile.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pears/provider/local_file.rb', line 8 def initialize(file_path, on_failure: :raise) yaml_data = File.read(file_path) @data = parse_yaml(yaml_data) rescue Errno::ENOENT, Pears::InvalidProviderData => error if on_failure == :null @data = {} else raise error end end |