I want to define the methods a Logger has on a module, and delegate them to a method that returns a Logger.
module MyLogger
def self.logger
# return a Logger, whatever
end
[:debug, :info, :warn, :error, :fatal] do |_method|
def self._method *args # WRONG. Want to define something named `_method` for the class
logger.send _method, *args
end
end
end
How do I fix the WRONG line so that this works?
1 Answer