Sha256: 08c15b6e9388c9d24170d2ec25456fdf1c62af01ea7375ccd267b542fe16a7e9

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

require 'key_tree/version'
require 'key_tree/tree'

# Manage a tree of keys
#
# Example:
#   kt=KeyTree[a: 1, b: { c: 2 }]
#   kt["a"]
#   -> 1
#   kt["b.c"]
#   -> 2
#
module KeyTree
  def self.[](contents = {})
    case contents
    when Hash
      KeyTree::Tree[contents]
    else
      raise ArgumentError, "can't load #{contents.class} into a KeyTree"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
key_tree-0.1.0 lib/key_tree.rb