Class: OneviewSDK::Config
- Inherits:
-
Object
- Object
- OneviewSDK::Config
- Defined in:
- lib/oneview-sdk/config_loader.rb
Overview
Configuration helper class to allow .yaml and .json files to be easily used to specify OneView Configuration
Class Method Summary collapse
-
.load(path) ⇒ Hash
Load config from .yaml or .json file.
Class Method Details
.load(path) ⇒ Hash
Load config from .yaml or .json file
22 23 24 25 26 27 28 29 |
# File 'lib/oneview-sdk/config_loader.rb', line 22 def self.load(path) path = File.join(Dir.pwd, path) unless Pathname.new(path).absolute? = File.(path) JSON.parse(IO.read()) rescue data = YAML.load_file() JSON.parse(data.to_json) # Convert to and from JSON to ensure compatibility end |