Module: ActiveSupport

Defined in:
lib/active_support/multibyte.rb,
lib/active_support/inflections.rb,
lib/active_support/lazy_load_hooks.rb,
lib/active_support/multibyte/chars.rb,
lib/active_support/multibyte/utils.rb,
lib/active_support/inflector/methods.rb,
lib/active_support/multibyte/unicode.rb,
lib/active_support/multibyte/exceptions.rb,
lib/active_support/inflector/inflections.rb,
lib/active_support/inflector/transliterate.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Inflector, Multibyte

Class Method Summary collapse

Class Method Details

.execute_hook(base, options, block) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/active_support/lazy_load_hooks.rb', line 32

def self.execute_hook(base, options, block)
  if options[:yield]
    block.call(base)
  else
    base.instance_eval(&block)
  end
end

.on_load(name, options = {}, &block) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/active_support/lazy_load_hooks.rb', line 24

def self.on_load(name, options = {}, &block)
  @loaded[name].each do |base|
    execute_hook(base, options, block)
  end

  @load_hooks[name] << [block, options]
end

.run_load_hooks(name, base = Object) ⇒ Object



40
41
42
43
44
45
# File 'lib/active_support/lazy_load_hooks.rb', line 40

def self.run_load_hooks(name, base = Object)
  @loaded[name] << base
  @load_hooks[name].each do |hook, options|
    execute_hook(base, options, hook)
  end
end