class OneviewSDK::Config
Configuration helper class to allow .yaml and .json files to be easily used to specify OneView Configuration
Public Class Methods
load(path)
click to toggle source
Load config from .yaml or .json file @param [String] path The full path to the configuration file @return [Hash] hash of the configuration
# File lib/oneview-sdk/config_loader.rb, line 22 def self.load(path) path = File.join(Dir.pwd, path) unless Pathname.new(path).absolute? expanded_path = File.expand_path(path) JSON.parse(IO.read(expanded_path)) rescue data = YAML.load_file(expanded_path) JSON.parse(data.to_json) # Convert to and from JSON to ensure compatibility end