lib/mixlib/config.rb in mixlib-config-3.0.6 vs lib/mixlib/config.rb in mixlib-config-3.0.9
- old
+ new
@@ -67,24 +67,24 @@
# Parses valid YAML structure into Ruby so it can be ingested into the Class
#
# === Parameters
# filename<String>:: A filename to read from
def from_yaml(filename)
- require "yaml"
+ require "yaml" unless defined?(YAML)
from_hash(YAML.load(IO.read(filename)))
end
# Parses valid JSON structure into Ruby
#
# === Parameters
# filename<String>:: A filename to read from
def from_json(filename)
- require "json"
+ require "json" unless defined?(JSON)
from_hash(JSON.parse(IO.read(filename)))
end
def from_toml(filename)
- require "tomlrb"
+ require "tomlrb" unless defined?(Tomlrb)
from_hash(Tomlrb.parse(IO.read(filename), symbolize_keys: true))
end
# Transforms a Hash into method-style configuration syntax to be processed
#