Module: ActiveSupport

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

Overview

:nodoc:

Defined Under Namespace

Modules: Autoload, 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, TestCase, TimeWithZone, TimeZone

Constant Summary collapse

Base64 =
::Base64
SecureRandom =

Use Ruby’s SecureRandom library.

ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActiveSupport::SecureRandom', ::SecureRandom)
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 'activesupport/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 'activesupport/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 'activesupport/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 'activesupport/lib/active_support/lazy_load_hooks.rb', line 24

def self.on_load(name, options = {}, &block)
  if base = @loaded[name]
    execute_hook(base, options, block)
  else
    @load_hooks[name] << [block, options]
  end
end

.on_load_all(&hook) ⇒ Object



29
# File 'activesupport/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 'activesupport/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