Module: ActiveSupport

### Home Classes Methods

### In Files

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

### Namespace

- MODULE ActiveSupport::Autoload
- MODULE ActiveSupport::Base64
- MODULE ActiveSupport::Benchmarkable
- MODULE ActiveSupport::Cache
- MODULE ActiveSupport::Callbacks
- MODULE ActiveSupport::Concern
- MODULE ActiveSupport::Configurable
- MODULE ActiveSupport::Dependencies
- MODULE ActiveSupport::Deprecation
- MODULE ActiveSupport::DescendantsTracker
- MODULE ActiveSupport::Gzip
- MODULE ActiveSupport::Inflector
- MODULE ActiveSupport::JSON
- MODULE ActiveSupport::Memoizable
- MODULE ActiveSupport::Multibyte
- MODULE ActiveSupport::Notifications
- MODULE ActiveSupport::Rescuable
- MODULE ActiveSupport::Testing
- MODULE ActiveSupport::XmlMini
- MODULE ActiveSupport::XmlMini_LibXMLSAX
- MODULE ActiveSupport::XmlMini_NokogiriSAX
- CLASS ActiveSupport::BacktraceCleaner
- CLASS ActiveSupport::BasicObject
- CLASS ActiveSupport::BufferedLogger
- CLASS ActiveSupport::Duration
- CLASS ActiveSupport::FileUpdateChecker
- CLASS ActiveSupport::FileWatcher
- CLASS ActiveSupport::HashWithIndifferentAccess
- CLASS ActiveSupport::InheritableOptions
- CLASS ActiveSupport::LogSubscriber
- CLASS ActiveSupport::MessageEncryptor
- CLASS ActiveSupport::MessageVerifier
- CLASS ActiveSupport::OrderedHash
- CLASS ActiveSupport::OrderedOptions
- CLASS ActiveSupport::Railtie
- CLASS ActiveSupport::SafeBuffer
- CLASS ActiveSupport::StringInquirer
- CLASS ActiveSupport::TaggedLogging
- CLASS ActiveSupport::TestCase
- CLASS ActiveSupport::TimeWithZone
- CLASS ActiveSupport::TimeZone

### Methods

- ::execute_hook
- ::load_all!
- ::on_load
- ::on_load_all
- ::run_load_hooks

### Class/Module Index

Quicksearch

- ActiveSupport
- ActiveSupport::Autoload
- ActiveSupport::BacktraceCleaner
- ActiveSupport::Base64
- ActiveSupport::BasicObject
- ActiveSupport::Benchmarkable
- ActiveSupport::BufferedLogger
- ActiveSupport::BufferedLogger::Severity
- ActiveSupport::Cache
- ActiveSupport::Cache::Entry
- ActiveSupport::Cache::FileStore
- ActiveSupport::Cache::MemCacheStore
- ActiveSupport::Cache::MemoryStore
- ActiveSupport::Cache::NullStore
- ActiveSupport::Cache::Store
- ActiveSupport::Cache::Strategy
- ActiveSupport::Cache::Strategy::LocalCache
- ActiveSupport::Cache::Strategy::LocalCache::LocalStore
- ActiveSupport::Callbacks
- ActiveSupport::Callbacks::ClassMethods
- ActiveSupport::Concern
- ActiveSupport::Configurable
- ActiveSupport::Configurable::ClassMethods
- ActiveSupport::Configurable::Configuration
- ActiveSupport::Dependencies
- ActiveSupport::Dependencies::ClassCache
- ActiveSupport::Dependencies::WatchStack
- ActiveSupport::Deprecation
- ActiveSupport::DescendantsTracker
- ActiveSupport::Duration
- ActiveSupport::FileUpdateChecker
- ActiveSupport::FileWatcher
- ActiveSupport::FileWatcher::Backend
- ActiveSupport::Gzip
- ActiveSupport::Gzip::Stream
- ActiveSupport::HashWithIndifferentAccess
- ActiveSupport::HashWithIndifferentAccess
- ActiveSupport::Inflector
- ActiveSupport::Inflector::Inflections
- ActiveSupport::InheritableOptions
- ActiveSupport::JSON
- ActiveSupport::JSON::Encoding
- ActiveSupport::JSON::Encoding::CircularReferenceError
- ActiveSupport::JSON::Encoding::Encoder
- ActiveSupport::JSON::Variable
- ActiveSupport::LogSubscriber
- ActiveSupport::LogSubscriber::TestHelper
- ActiveSupport::LogSubscriber::TestHelper::MockLogger
- ActiveSupport::Memoizable
- ActiveSupport::Memoizable::InstanceMethods
- ActiveSupport::MessageEncryptor
- ActiveSupport::MessageEncryptor::InvalidMessage
- ActiveSupport::MessageVerifier
- ActiveSupport::MessageVerifier::InvalidSignature
- ActiveSupport::Multibyte
- ActiveSupport::Multibyte::Chars
- ActiveSupport::Multibyte::EncodingError
- ActiveSupport::Multibyte::Unicode
- ActiveSupport::Multibyte::Unicode::Codepoint
- ActiveSupport::Multibyte::Unicode::UnicodeDatabase
- ActiveSupport::Notifications
- ActiveSupport::Notifications::Event
- ActiveSupport::Notifications::Fanout
- ActiveSupport::Notifications::Instrumenter
- ActiveSupport::OrderedHash
- ActiveSupport::OrderedOptions
- ActiveSupport::Railtie
- ActiveSupport::Rescuable
- ActiveSupport::Rescuable::ClassMethods
- ActiveSupport::SafeBuffer
- ActiveSupport::SafeBuffer::SafeConcatError
- ActiveSupport::StringInquirer
- ActiveSupport::TaggedLogging
- ActiveSupport::TestCase
- ActiveSupport::Testing
- ActiveSupport::Testing::Assertions
- ActiveSupport::Testing::Declarative
- ActiveSupport::Testing::Isolation
- ActiveSupport::Testing::Isolation::Forking
- ActiveSupport::Testing::Isolation::MiniTest
- ActiveSupport::Testing::Isolation::Subprocess
- ActiveSupport::Testing::Isolation::TestUnit
- ActiveSupport::Testing::Pending
- ActiveSupport::Testing::Performance
- ActiveSupport::Testing::Performance::Benchmarker
- ActiveSupport::Testing::Performance::ForClassicTestUnit
- ActiveSupport::Testing::Performance::ForMiniTest
- ActiveSupport::Testing::Performance::Metrics
- ActiveSupport::Testing::Performance::Metrics::Amount
- ActiveSupport::Testing::Performance::Metrics::Base
- ActiveSupport::Testing::Performance::Metrics::CpuTime
- ActiveSupport::Testing::Performance::Metrics::DigitalInformationUnit
- ActiveSupport::Testing::Performance::Metrics::GcRuns
- ActiveSupport::Testing::Performance::Metrics::GcTime
- ActiveSupport::Testing::Performance::Metrics::Memory
- ActiveSupport::Testing::Performance::Metrics::Objects
- ActiveSupport::Testing::Performance::Metrics::ProcessTime
- ActiveSupport::Testing::Performance::Metrics::Time
- ActiveSupport::Testing::Performance::Metrics::UserTime
- ActiveSupport::Testing::Performance::Metrics::WallTime
- ActiveSupport::Testing::Performance::Performer
- ActiveSupport::Testing::Performance::Profiler
- ActiveSupport::Testing::ProxyTestResult
- ActiveSupport::Testing::RemoteError
- ActiveSupport::Testing::SetupAndTeardown
- ActiveSupport::Testing::SetupAndTeardown::ClassMethods
- ActiveSupport::Testing::SetupAndTeardown::ForClassicTestUnit
- ActiveSupport::Testing::SetupAndTeardown::ForMiniTest
- ActiveSupport::TimeWithZone
- ActiveSupport::TimeZone
- ActiveSupport::XmlMini
- ActiveSupport::XmlMini_LibXMLSAX
- ActiveSupport::XmlMini_LibXMLSAX::HashBuilder
- ActiveSupport::XmlMini_NokogiriSAX
- ActiveSupport::XmlMini_NokogiriSAX::HashBuilder
- Test
- Test::Unit
- Test::Unit::Collector
- Test::Unit::Collector::ObjectSpace
- Object
- Object::HashWithIndifferentAccess
- Object::MissingSourceFile
- ERB
- ERB::Util
- I18n
- I18n::Railtie
- LoadError
- LoadError
- Logger
- Logger::SimpleFormatter
- Array
- Base64
- Benchmark
- BigDecimal
- Class
- Date
- DateTime
- Enumerable
- FalseClass
- File
- Float
- Hash
- Integer
- Kernel
- Module
- NameError
- NilClass
- Numeric
- Process
- QualifiedConstUtils
- Range
- Regexp
- String
- Symbol
- Time
- TrueClass
- URI

No matching classes.

# ActiveSupport

This class has dubious semantics and we only have it so that people can write `params[:key]` instead of `params['key']` and they get the same value for both keys.

lazy_load_hooks allows rails to lazily load a lot of components and thus making the app boot faster. Because of this feature now there is no need to require `ActiveRecord::Base` at boot time purely to apply configuration. Instead a hook is registered that applies configuration once `ActiveRecord::Base` is loaded. Here `ActiveRecord::Base` is used as example but this feature can be applied elsewhere too.

Here is an example where `on_load` method is called to register a hook.

    initializer "active_record.initialize_timezone" do
      ActiveSupport.on_load(:active_record) do
        self.time_zone_aware_attributes = true
        self.default_timezone = :utc
      end
    end

When the entirety of `activerecord/lib/active_record/base.rb` has been evaluated then `run_load_hooks` is invoked. The very last line of `activerecord/lib/active_record/base.rb` is:

    ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)

Some code from jeremymcanally’s “pending” github.com/jeremymcanally/pending/tree/master

The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following:

- Limit the set of zones provided by TZInfo to a meaningful subset of 142 zones.

- Retrieve and display zones with a friendlier name (e.g., “Eastern Time (US & Canada)” instead of “America/New_York”).

- Lazily load TZInfo::Timezone instances only when they’re needed.

- Create ActiveSupport::TimeWithZone instances via TimeZone’s `local`, `parse`, `at` and `now` methods.

If you set `config.time_zone` in the Rails Application, you can access this TimeZone object via `Time.zone`:

    # application.rb:
    class Application < Rails::Application
      config.time_zone = "Eastern Time (US & Canada)"
    end

    Time.zone       # => #<TimeZone:0x514834...>
    Time.zone.name  # => "Eastern Time (US & Canada)"
    Time.zone.now   # => Sun, 18 May 2008 14:30:44 EDT -04:00

The version of TZInfo bundled with Active Support only includes the definitions necessary to support the zones defined by the TimeZone class. If you need to use zones that aren’t defined by TimeZone, you’ll need to install the TZInfo gem (if a recent version of the gem is installed locally, this will be used instead of the bundled version.)

# XmlMini JRuby JDOM implementation

# XmlMini LibXML implementation

# XmlMini LibXML implementation using a SAX-based parser

# XmlMini Nokogiri implementation

# XmlMini Nokogiri implementation using a SAX-based parser

# XmlMini ReXML implementation

### Constants

FrozenObjectError

### Attributes

load_all_hooks[RW]

### Public Class Methods

execute_hook(base, options, block) click to toggle source

    # 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!() click to toggle source

    # File lib/active_support.rb, line 30
    def load_all!; load_all_hooks.each { |hook| hook.call } end

on_load(name, options = {}, &block) click to toggle source

    # 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) click to toggle source

    # File lib/active_support.rb, line 29
    def on_load_all(&hook) load_all_hooks << hook end

run_load_hooks(name, base = Object) click to toggle source

    # 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.