lib/mixlib/config.rb in mixlib-config-2.2.5 vs lib/mixlib/config.rb in mixlib-config-2.2.6

- old
+ new

@@ -55,10 +55,12 @@ def from_file(filename) if %w{ .yml .yaml }.include?(File.extname(filename)) from_yaml(filename) elsif File.extname(filename) == ".json" from_json(filename) + elsif File.extname(filename) == ".toml" + from_toml(filename) else instance_eval(IO.read(filename), filename, 1) end end @@ -76,9 +78,14 @@ # === Parameters # filename<String>:: A filename to read from def from_json(filename) require "json" from_hash(JSON.parse(IO.read(filename)), filename) + end + + def from_toml(filename) + require "tomlrb" + from_hash(Tomlrb.parse(IO.read(filename), symbolize_keys: true)) end # Transforms a Hash into method-style configuration syntax to be processed # # === Parameters