Module: Nanoboy::Hook::ConstSetHook

Defined in:
lib/nanoboy/hook.rb

Overview

This module allows to also fire Nanoboy when defining new classes using the Module#const_set method

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



29
30
31
# File 'lib/nanoboy/hook.rb', line 29

def self.included klass
  Hook.nanoboy_alias klass, :const_set
end

Instance Method Details

#const_set_with_nanoboy(name, klass) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/nanoboy/hook.rb', line 21

def const_set_with_nanoboy(name, klass)
  set_object = const_set_without_nanoboy(name, klass)
  if set_object.is_a? Class
    Nanoboy.load_extensions_for set_object
  end
  set_object
end