Class: Puppet::Pops::Containment::EAllContainersEnumerator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/puppet/pops/containment.rb

Instance Method Summary collapse

Constructor Details

#initialize(o) ⇒ EAllContainersEnumerator

Returns a new instance of EAllContainersEnumerator.



20
21
22
# File 'lib/puppet/pops/containment.rb', line 20

def initialize o
  @element = o
end

Instance Method Details

#each(&block) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/puppet/pops/containment.rb', line 24

def each &block
  if block_given?
    eAllContainers(@element, &block)
  else
    self
  end
end

#eAllContainers(element, &block) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/puppet/pops/containment.rb', line 32

def eAllContainers(element, &block)
  x = element.eContainer
  while !x.nil? do
    yield x
    x = x.eContainer
  end
end