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.



6
7
8
9
10
# File 'lib/puppet/settings/alias_setting.rb', line 6

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



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

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

Instance Attribute Details

#alias_nameObject (readonly)

Returns the value of attribute alias_name.



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

def alias_name
  @alias_name
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#getopt_argsObject



18
19
20
21
22
# File 'lib/puppet/settings/alias_setting.rb', line 18

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

#optparse_argsObject



12
13
14
15
16
# File 'lib/puppet/settings/alias_setting.rb', line 12

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

#typeObject



24
25
26
# File 'lib/puppet/settings/alias_setting.rb', line 24

def type
  :alias
end