Class: DebugLogging::InstanceNotifier

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

Instance Method Summary collapse

Constructor Details

#initialize(i_methods: nil) ⇒ InstanceNotifier

Returns a new instance of InstanceNotifier.



5
6
7
8
# File 'lib/debug_logging/instance_notifier.rb', line 5

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

Instance Method Details

#included(base) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/debug_logging/instance_notifier.rb', line 10

def included(base)
  return unless @instance_methods_to_notify

  base.send(:include, ArgumentPrinter)
  instance_method_notifier = DebugLogging::InstanceNotifierModulizer.to_mod(methods_to_notify: @instance_methods_to_notify)
  base.send(:prepend, instance_method_notifier)
end