Class: Puppet::Settings::AliasSetting

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/settings/alias_setting.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ AliasSetting

Returns a new instance of AliasSetting.


4
5
6
7
8
# File 'lib/puppet/settings/alias_setting.rb', line 4

def initialize(args = {})
  @name = args[:name]
  @alias_name = args[:alias_for]
  @alias_for = Puppet.settings.setting(alias_name)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object


26
27
28
29
30
31
32
# File 'lib/puppet/settings/alias_setting.rb', line 26

def method_missing(method, *args)
  begin
    alias_for.send(method, *args)
  rescue => e
    Puppet.log_exception(self.class, e.message)
  end
end

Instance Attribute Details

#alias_nameObject (readonly)

Returns the value of attribute alias_name.


2
3
4
# File 'lib/puppet/settings/alias_setting.rb', line 2

def alias_name
  @alias_name
end

#nameObject (readonly)

Returns the value of attribute name.


2
3
4
# File 'lib/puppet/settings/alias_setting.rb', line 2

def name
  @name
end

Instance Method Details

#getopt_argsObject


16
17
18
19
20
# File 'lib/puppet/settings/alias_setting.rb', line 16

def getopt_args
  args = @alias_for.getopt_args
  args[0].gsub!(alias_name.to_s, name.to_s)
  args
end

#optparse_argsObject


10
11
12
13
14
# File 'lib/puppet/settings/alias_setting.rb', line 10

def optparse_args
  args = @alias_for.optparse_args
  args[0].gsub!(alias_name.to_s, name.to_s)
  args
end

#typeObject


22
23
24
# File 'lib/puppet/settings/alias_setting.rb', line 22

def type
  :alias
end