lib/key_tree.rb in key_tree-0.1.0 vs lib/key_tree.rb in key_tree-0.2.0
- old
+ new
@@ -1,7 +1,8 @@
require 'key_tree/version'
require 'key_tree/tree'
+require 'key_tree/forest'
# Manage a tree of keys
#
# Example:
# kt=KeyTree[a: 1, b: { c: 2 }]
@@ -13,9 +14,11 @@
module KeyTree
def self.[](contents = {})
case contents
when Hash
KeyTree::Tree[contents]
+ when Array
+ KeyTree::Forest[*contents]
else
raise ArgumentError, "can't load #{contents.class} into a KeyTree"
end
end
end