Class: Puppet::Util::Log::Destination
- Defined in:
- lib/puppet/util/log/destination.rb
Overview
A type of log destination.
Class Attribute Summary collapse
-
.name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
- .initvars ⇒ Object
-
.match(obj) ⇒ Object
Mark the things we’re supposed to match.
-
.match?(obj) ⇒ Boolean
See whether we match a given thing.
-
.sethandler(&block) ⇒ Object
Set how to handle a message.
-
.setinit(&block) ⇒ Object
Mark how to initialize our object.
Instance Method Summary collapse
Class Attribute Details
.name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/puppet/util/log/destination.rb', line 5 def name @name end |
Class Method Details
.initvars ⇒ Object
8 9 10 |
# File 'lib/puppet/util/log/destination.rb', line 8 def self.initvars @matches = [] end |
.match(obj) ⇒ Object
Mark the things we’re supposed to match.
13 14 15 16 |
# File 'lib/puppet/util/log/destination.rb', line 13 def self.match(obj) @matches ||= [] @matches << obj end |
.match?(obj) ⇒ Boolean
See whether we match a given thing.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/puppet/util/log/destination.rb', line 19 def self.match?(obj) # Convert single-word strings into symbols like :console and :syslog if obj.is_a? String and obj =~ /^\w+$/ obj = obj.downcase.intern end @matches.each do |thing| # Search for direct matches or class matches return true if thing === obj or thing == obj.class.to_s end false end |
.sethandler(&block) ⇒ Object
Set how to handle a message.
41 42 43 |
# File 'lib/puppet/util/log/destination.rb', line 41 def self.sethandler(&block) define_method(:handle, &block) end |
.setinit(&block) ⇒ Object
Mark how to initialize our object.
46 47 48 |
# File 'lib/puppet/util/log/destination.rb', line 46 def self.setinit(&block) define_method(:initialize, &block) end |
Instance Method Details
#name ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/puppet/util/log/destination.rb', line 32 def name if defined?(@name) return @name else return self.class.name end end |