A property for one entry in a .ini-style file
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
# File lib/puppet/type/yumrepo.rb, line 34 def inikey name.to_s end
# 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
# File lib/puppet/type/yumrepo.rb, line 30 def retrieve resource.section[inikey] end
# 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