module ActiveSupport

Ruby on Rails 2.2.3

Since v2.2.3

Available in: v2.2.3 v2.3.18 v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

A base class with no predefined methods that tries to behave like Builder’s BlankSlate in Ruby 1.9. In Ruby pre-1.9, this is actually the Builder::BlankSlate class.

Ruby 1.9 introduces BasicObject which differs slightly from Builder’s BlankSlate that has been used so far. ActiveSupport::BasicObject provides a barebones base class that emulates Builder::BlankSlate while still relying on Ruby 1.9’s BasicObject in Ruby 1.9.

OrderedHash is namespaced to prevent conflicts with other implementations

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 Initializer, you can access this TimeZone object via Time.zone:

# environment.rb:
Rails::Initializer.run do |config|
  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.)

Namespace

Modules

Classes

Constants

Methods (defined here)

Type at least 2 characters to search.

↑↓ navigate · open · esc close