Class: SimpleDebugLogging

Inherits:
Module
  • Object
show all
Defined in:
lib/simple_debug_logging.rb

Overview

Simpler version of what the sibling DebugLogging library does. Included as a bauble.

Automatically log Class.method(arguments) as they are called at runtime!

NOTE: For a more advanced version see the debug_logging gem NOTE: The manner this is made to work for class methods is totally different than the way this is made to work for instance methods. NOTE: The instance method manner of logging works on Ruby 2.0+ NOTE: The class method manner of logging works on Ruby 2.1+

Defined Under Namespace

Modules: ClassMethodLogger, InstanceMethodLoggerModulizer

Instance Method Summary collapse

Constructor Details

#initialize(i_methods: nil) ⇒ SimpleDebugLogging

Returns a new instance of SimpleDebugLogging.



10
11
12
# File 'lib/simple_debug_logging.rb', line 10

def initialize(i_methods: nil)
  @instance_methods_to_log = Array(i_methods) if i_methods
end

Instance Method Details

#included(base) ⇒ Object



13
14
15
16
# File 'lib/simple_debug_logging.rb', line 13

def included(base)
  instance_method_logger = InstanceMethodLoggerModulizer.to_mod(@instance_methods_to_log)
  base.send(:prepend, instance_method_logger)
end