class Puppet::IniProperty

A property for one entry in a .ini-style file

Public Class Methods

inikey(key) click to toggle source

Set the key associated with this property to KEY, instead of using the property’s NAME

# File lib/puppet/type/yumrepo.rb, line 40
def self.inikey(key)
  # Override the inikey instance method
  # Is there a way to do this without resorting to strings ?
  # Using a block fails because the block can't access
  # the variable 'key' in the outer scope
  self.class_eval("def inikey ; \"#{key.to_s}\" ; end")
end

Public Instance Methods

inikey() click to toggle source
# File lib/puppet/type/yumrepo.rb, line 34
def inikey
  name.to_s
end
insync?(is) click to toggle source
Calls superclass method Puppet::Property#insync?
# File lib/puppet/type/yumrepo.rb, line 8
def insync?(is)
  # A should property of :absent is the same as nil
  if is.nil? && should == :absent
    return true
  end
  super(is)
end
retrieve() click to toggle source
# File lib/puppet/type/yumrepo.rb, line 30
def retrieve
  resource.section[inikey]
end
sync() click to toggle source
# File lib/puppet/type/yumrepo.rb, line 16
def sync
  if safe_insync?(retrieve)
    result = nil
  else
    result = set(self.should)
    if should == :absent
      resource.section[inikey] = nil
    else
      resource.section[inikey] = should
    end
  end
  result
end