class Puppet::Util::Log::Destination

A type of log destination.

Attributes

name[RW]

Public Class Methods

initvars() click to toggle source
   # File lib/puppet/util/log/destination.rb
 8 def self.initvars
 9   @matches = []
10 end
match(obj) click to toggle source

Mark the things we're supposed to match.

   # File lib/puppet/util/log/destination.rb
13 def self.match(obj)
14   @matches ||= []
15   @matches << obj
16 end
match?(obj) click to toggle source

See whether we match a given thing.

   # File lib/puppet/util/log/destination.rb
19 def self.match?(obj)
20   # Convert single-word strings into symbols like :console and :syslog
21   if obj.is_a? String and obj =~ /^\w+$/
22     obj = obj.downcase.intern
23   end
24 
25   @matches.each do |thing|
26     # Search for direct matches or class matches
27     return true if thing === obj or thing == obj.class.to_s
28   end
29   false
30 end
sethandler(&block) click to toggle source

Set how to handle a message.

   # File lib/puppet/util/log/destination.rb
41 def self.sethandler(&block)
42   define_method(:handle, &block)
43 end
setinit(&block) click to toggle source

Mark how to initialize our object.

   # File lib/puppet/util/log/destination.rb
46 def self.setinit(&block)
47   define_method(:initialize, &block)
48 end

Public Instance Methods

name() click to toggle source
   # File lib/puppet/util/log/destination.rb
32 def name
33   if defined?(@name)
34     return @name
35   else
36     return self.class.name
37   end
38 end