Sha256: 8f23a03221360de7cdb5cf5666e7f215bbf9e802634845b78bbb797c3d35d97d
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
module Rambling # Provides some proxy methods to the children's hash for readability. module ChildrenHashDeferer # Proxies to @children[key] # @param [Symbol] key the key to look for in the children's hash. # @return [TrieNode, nil] the child node with that key or nil. def [](key) @children[key] end # Proxies to @children[key] = value. # @param [Symbol] key the to add or change the value for. # @param [TrieNode] value the node to add to the children's hash. # @return [TrieNode, nil] the child node with that key or nil. def []=(key, value) @children[key] = value end # Proxies to @children.delete(key) # @param [Symbol] key the key to delete in the children's hash. # @return [TrieNode, nil] the child node corresponding to the key just deleted or nil. def delete(key) @children.delete(key) end # Proxies to @children.has_key?(key) # @param [Symbol] key the key to look for in the children's hash. # @return [Boolean] `true` for the keys that exist in the children's hash, false otherwise. def has_key?(key) @children.has_key?(key) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rambling-trie-0.4.0 | lib/rambling-trie/children_hash_deferer.rb |
rambling-trie-0.3.4 | ./lib/children_hash_deferer.rb |
rambling-trie-0.3.3 | ./lib/children_hash_deferer.rb |