Module: ActiveSupport

Extended by:
Autoload
Defined in:
lib/active_support/multibyte.rb,
lib/active_support.rb,
lib/active_support.rb,
lib/active_support/gzip.rb,
lib/active_support/time.rb,
lib/active_support/cache.rb,
lib/active_support/concern.rb,
lib/active_support/railtie.rb,
lib/active_support/version.rb,
lib/active_support/duration.rb,
lib/active_support/xml_mini.rb,
lib/active_support/callbacks.rb,
lib/active_support/rescuable.rb,
lib/active_support/test_case.rb,
lib/active_support/memoizable.rb,
lib/active_support/deprecation.rb,
lib/active_support/inflections.rb,
lib/active_support/basic_object.rb,
lib/active_support/configurable.rb,
lib/active_support/dependencies.rb,
lib/active_support/file_watcher.rb,
lib/active_support/ordered_hash.rb,
lib/active_support/benchmarkable.rb,
lib/active_support/json/decoding.rb,
lib/active_support/json/encoding.rb,
lib/active_support/json/variable.rb,
lib/active_support/notifications.rb,
lib/active_support/option_merger.rb,
lib/active_support/time/autoload.rb,
lib/active_support/xml_mini/jdom.rb,
lib/active_support/log_subscriber.rb,
lib/active_support/tagged_logging.rb,
lib/active_support/time_with_zone.rb,
lib/active_support/xml_mini/rexml.rb,
lib/active_support/buffered_logger.rb,
lib/active_support/lazy_load_hooks.rb,
lib/active_support/multibyte/chars.rb,
lib/active_support/multibyte/utils.rb,
lib/active_support/ordered_options.rb,
lib/active_support/string_inquirer.rb,
lib/active_support/testing/pending.rb,
lib/active_support/xml_mini/libxml.rb,
lib/active_support/cache/file_store.rb,
lib/active_support/cache/null_store.rb,
lib/active_support/message_verifier.rb,
lib/active_support/values/time_zone.rb,
lib/active_support/backtrace_cleaner.rb,
lib/active_support/inflector/methods.rb,
lib/active_support/message_encryptor.rb,
lib/active_support/multibyte/unicode.rb,
lib/active_support/testing/isolation.rb,
lib/active_support/xml_mini/nokogiri.rb,
lib/active_support/cache/memory_store.rb,
lib/active_support/core_ext/exception.rb,
lib/active_support/testing/assertions.rb,
lib/active_support/xml_mini/libxmlsax.rb,
lib/active_support/descendants_tracker.rb,
lib/active_support/file_update_checker.rb,
lib/active_support/testing/declarative.rb,
lib/active_support/testing/deprecation.rb,
lib/active_support/testing/performance.rb,
lib/active_support/multibyte/exceptions.rb,
lib/active_support/notifications/fanout.rb,
lib/active_support/xml_mini/nokogirisax.rb,
lib/active_support/cache/mem_cache_store.rb,
lib/active_support/dependencies/autoload.rb,
lib/active_support/deprecation/behaviors.rb,
lib/active_support/deprecation/reporting.rb,
lib/active_support/inflector/inflections.rb,
lib/active_support/inflector/transliterate.rb,
lib/active_support/testing/performance/ruby.rb,
lib/active_support/testing/performance/jruby.rb,
lib/active_support/cache/strategy/local_cache.rb,
lib/active_support/deprecation/proxy_wrappers.rb,
lib/active_support/log_subscriber/test_helper.rb,
lib/active_support/notifications/instrumenter.rb,
lib/active_support/testing/setup_and_teardown.rb,
lib/active_support/deprecation/method_wrappers.rb,
lib/active_support/hash_with_indifferent_access.rb,
lib/active_support/testing/performance/rubinius.rb,
lib/active_support/testing/performance/ruby/mri.rb,
lib/active_support/core_ext/string/output_safety.rb,
lib/active_support/testing/performance/ruby/yarv.rb,
lib/active_support/base64.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Autoload, Base64, Benchmarkable, Cache, Callbacks, Concern, Configurable, Dependencies, Deprecation, DescendantsTracker, Gzip, Inflector, JSON, Memoizable, Multibyte, Notifications, Rescuable, Testing, VERSION, XmlMini, XmlMini_JDOM, XmlMini_LibXML, XmlMini_LibXMLSAX, XmlMini_Nokogiri, XmlMini_NokogiriSAX, XmlMini_REXML Classes: BacktraceCleaner, BasicObject, BufferedLogger, Duration, FileUpdateChecker, FileWatcher, HashWithIndifferentAccess, InheritableOptions, LogSubscriber, MessageEncryptor, MessageVerifier, OptionMerger, OrderedHash, OrderedOptions, Railtie, SafeBuffer, StringInquirer, TaggedLogging, TestCase, TimeWithZone, TimeZone

Constant Summary collapse

FrozenObjectError =
RUBY_VERSION < '1.9' ? TypeError : RuntimeError

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Autoload

autoload, autoload_at, autoload_under, autoloads, eager_autoload, eager_autoload!

Class Attribute Details

.load_all_hooksObject

Returns the value of attribute load_all_hooks.



28
29
30
# File 'lib/active_support.rb', line 28

def load_all_hooks
  @load_all_hooks
end

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

.load_all!Object



30
# File 'lib/active_support.rb', line 30

def load_all!; load_all_hooks.each { |hook| hook.call } 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

.on_load_all(&hook) ⇒ Object



29
# File 'lib/active_support.rb', line 29

def on_load_all(&hook) load_all_hooks << hook 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