class Dbee::KeyChain
A KeyChain
is a collection of KeyPath
objects. It knows how to deal with aggregate methods, such as equality of a set of KeyPath
objects and finding an ancestor path in all the KeyPath
objects' ancestor paths. You can pass in either KeyPath
instances or strings, which will be coerced to KeyPath
objects. Duplicates will also be removed.
Constants
- COLUMN_PLACEHOLDER
Attributes
ancestor_path_set[R]
key_path_set[R]
Public Class Methods
new(key_paths = [])
click to toggle source
# File lib/dbee/key_chain.rb, line 20 def initialize(key_paths = []) @key_path_set = key_paths.map { |k| KeyPath.get(k) }.to_set @ancestor_path_set = @key_path_set.map(&:ancestor_paths).flatten.to_set freeze end
Public Instance Methods
==(other)
click to toggle source
# File lib/dbee/key_chain.rb, line 31 def ==(other) other.instance_of?(self.class) && key_path_set == other.key_path_set end
Also aliased as: eql?
ancestor_path?(*parts)
click to toggle source
# File lib/dbee/key_chain.rb, line 36 def ancestor_path?(*parts) path = parts.flatten.compact.join(KeyPath::SPLIT_CHAR) ancestor_path_set.include?(path) end
hash()
click to toggle source
# File lib/dbee/key_chain.rb, line 27 def hash key_path_set.hash end