Class: ConfigLoader
- Inherits:
-
Object
- Object
- ConfigLoader
- Defined in:
- lib/config_loader.rb,
lib/config_loader/version.rb
Defined Under Namespace
Classes: NoConfigError
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename: nil, stream: nil, stream_loader: nil) ⇒ ConfigLoader
constructor
A new instance of ConfigLoader.
- #read ⇒ Object
Constructor Details
#initialize(filename: nil, stream: nil, stream_loader: nil) ⇒ ConfigLoader
Returns a new instance of ConfigLoader.
8 9 10 11 12 |
# File 'lib/config_loader.rb', line 8 def initialize(filename: nil, stream: nil, stream_loader: nil) @filename = locate_config_file(filename) @stream = stream @stream_loader = stream_loader || YAML end |
Class Method Details
.version ⇒ Object
3 |
# File 'lib/config_loader/version.rb', line 3 def self.version; VERSION; end |
Instance Method Details
#read ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/config_loader.rb', line 15 def read open_stream if block_given? yield handle else @stream_loader.load_stream(handle)[0] end close_stream end |