Class: Pebbles::Uid::Roots

Inherits:
Object
  • Object
show all
Defined in:
lib/pebbles-uid/roots.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uids) ⇒ Roots

Returns a new instance of Roots.



6
7
8
9
10
11
# File 'lib/pebbles-uid/roots.rb', line 6

def initialize(uids)
  @paths = {}
  uids.each { |uid|
    @paths[uid] = Labels.new(Pebbles::Uid.path(uid))
  }
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



5
6
7
# File 'lib/pebbles-uid/roots.rb', line 5

def paths
  @paths
end

Instance Method Details

#uniqueObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pebbles-uid/roots.rb', line 13

def unique
  unless @unique
    @unique = []
    paths.each do |uid, path|
      unless paths.any? { |_, other| path.child_of?(other) }
        @unique << uid
      end
    end
  end
  @unique
end