class CLIUtils::LoggerDelegator
¶ ↑
LoggerDelegator Class
Manages any configuration values and the flat YAML file into which they get stored.
¶ ↑
Attributes
Public Class Methods
delegate()
click to toggle source
delegate_all method
Creates delegator methods for all of the methods on IO. @return void
# File lib/cliutils/logger-delegator.rb, line 47 def self.delegate %w(log debug info warn error section success).each do |m| define_method(m) do |*args| @targets.map { |t| t.send(m, *args) } end end end
Public Instance Methods
attach(target)
click to toggle source
attach method
Attaches a new target to delegate to. @return void
# File lib/cliutils/logger-delegator.rb, line 35 def attach(target) @targets << target LoggerDelegator.delegate end
detach(target)
click to toggle source
detach method
Detaches a delegation target. @return void
# File lib/cliutils/logger-delegator.rb, line 61 def detach(target) @targets.delete(target) LoggerDelegator.delegate end