Module: RubySmart::SimpleLogger::KlassLogger
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object
35
36
37
38
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 35
def method_missing(name, *args, **kwargs, &block)
return self.klass_logger.send(name, *args, **kwargs, &block) if self.klass_logger.respond_to? name
super
end
|
Class Method Details
.extended(base) ⇒ Object
6
7
8
9
10
11
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 6
def self.extended(base)
base.send(:include, RubySmart::SimpleLogger::Logger::Severity)
base.class_eval do
self.klass_logger_opts = {}
end
end
|
Instance Method Details
#clear! ⇒ Object
31
32
33
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 31
def clear!
@klass_logger = nil
end
|
#klass_logger ⇒ Object
27
28
29
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 27
def klass_logger
@klass_logger ||= self.new(self.klass_logger_opts.dup)
end
|
#klass_logger_opts ⇒ Object
13
14
15
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 13
def klass_logger_opts
class_variable_get('@@klass_logger_opts')
end
|
#klass_logger_opts=(opts) ⇒ Object
17
18
19
20
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 17
def klass_logger_opts=(opts)
clear!
class_variable_set('@@klass_logger_opts', opts)
end
|
#new(*args) ⇒ Object
delegate new method to Logger
#respond_to?(method_name, _include_private = false) ⇒ Boolean
40
41
42
|
# File 'lib/ruby_smart/simple_logger/klass_logger.rb', line 40
def respond_to?(method_name, _include_private = false)
self.klass_logger.respond_to? method_name
end
|