Class: NatsWork::LoggerProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/natswork/logger.rb

Overview

LoggerProxy allows for lazy initialization and swappable loggers

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target = nil) ⇒ LoggerProxy



163
164
165
# File 'lib/natswork/logger.rb', line 163

def initialize(target = nil)
  @target = target
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



169
170
171
# File 'lib/natswork/logger.rb', line 169

def method_missing(method, *args, &block)
  target.send(method, *args, &block)
end

Instance Attribute Details

#target=(value) ⇒ Object

Sets the attribute target



167
168
169
# File 'lib/natswork/logger.rb', line 167

def target=(value)
  @target = value
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean



173
174
175
# File 'lib/natswork/logger.rb', line 173

def respond_to_missing?(method, include_private = false)
  target.respond_to?(method, include_private) || super
end