Module: BeforeHooks::ClassMethods

Defined in:
lib/before_hooks.rb

Instance Method Summary collapse

Instance Method Details

#extend(*modules) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/before_hooks.rb', line 10

def extend(*modules)
  modules.each do |_module|
    if _module.singleton_class.instance_methods.include? :before_extended
      _module.before_extended(self)
    end
  end

  super
end

#include(*modules) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/before_hooks.rb', line 20

def include(*modules)
  modules.each do |_module|
    if _module.singleton_class.instance_methods.include? :before_included
      _module.before_included(self)
    end
  end

  super
end

#prepend(*modules) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/before_hooks.rb', line 30

def prepend(*modules)
  modules.each do |_module|
    if _module.singleton_class.instance_methods.include? :before_prepended
      _module.before_prepended(self)
    end
  end

  super
end