Module: LibraryTree::Watcher

Defined in:
lib/library_tree/watcher.rb

Overview

Public API module to enable watching on modules that include it. When a watched module is included into another watched module, a link is recorded.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ void

This method returns an undefined value.

Mark the including module as tracked and extend it to observe future inclusions

Parameters:

  • mod (Module)


26
27
28
29
30
31
# File 'lib/library_tree/watcher.rb', line 26

def included(mod)
  # Mark the module itself as tracked
  LibraryTree::Registry.mark_tracked(mod)
  # Ensure we observe future inclusions of this module into other modules
  mod.extend(ClassMethods)
end