Class: MethodDelegationTest::ConstPathElement

Inherits:
Module
  • Object
show all
Defined in:
lib/puppet/vendor/rgen/test/method_delegation_test.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, parent = nil) ⇒ ConstPathElement

Returns a new instance of ConstPathElement.



33
34
35
36
# File 'lib/puppet/vendor/rgen/test/method_delegation_test.rb', line 33

def initialize(name, parent=nil)
  @name = name.to_s
  @parent = parent
end

Class Method Details

.const_missing_delegated(delegator, const) ⇒ Object



30
31
32
# File 'lib/puppet/vendor/rgen/test/method_delegation_test.rb', line 30

def self.const_missing_delegated(delegator, const)
  ConstPathElement.new(const)
end

Instance Method Details

#const_missing(const) ⇒ Object



37
38
39
# File 'lib/puppet/vendor/rgen/test/method_delegation_test.rb', line 37

def const_missing(const)
  ConstPathElement.new(const, self)
end

#to_sObject



40
41
42
43
44
45
46
# File 'lib/puppet/vendor/rgen/test/method_delegation_test.rb', line 40

def to_s
  if @parent
    @parent.to_s+"::"+@name
  else
    @name
  end
end