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.
XmlMini LibXML implementation
XmlMini JRuby JDOM implementation
XmlMini ReXML implementation
XmlMini Nokogiri implementation using a SAX-based parser
XmlMini LibXML implementation using a SAX-based parser
XmlMini Nokogiri implementation
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)
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
andnow
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.)
Some code from jeremymcanally’s “pending” github.com/jeremymcanally/pending/tree/master
- 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
FrozenObjectError | = | RUBY_VERSION < '1.9' ? TypeError : RuntimeError |