跳至内容 跳至搜索

Active Support – 实用类和 Rails 的 Ruby 扩展

Active Support 是实用类和标准库扩展的集合,发现对 Rails 框架很有用。这些附加内容位于此软件包中,以便可以在 Rails 之外的 Ruby 项目中根据需要加载它们。

您可以在 Active Support Core Extensions 指南中阅读有关扩展的更多信息。

下载和安装

Active Support 的最新版本可以使用 RubyGems 安装

$ gem install activesupport

源代码可以作为 GitHub 上 Rails 项目的一部分下载

许可证

Active Support 在 MIT 许可下发布

支持

API 文档位于

Ruby on Rails 项目的错误报告可以提交到这里

功能请求应在此处的 rails-core 邮件列表中讨论

命名空间
方法
C
E
G
T
U
V

类公共方法

cache_format_version()

# File activesupport/lib/active_support.rb, line 104
def self.cache_format_version
  Cache.format_version
end

cache_format_version=(value)

# File activesupport/lib/active_support.rb, line 108
def self.cache_format_version=(value)
  Cache.format_version = value
end

eager_load!()

# File activesupport/lib/active_support.rb, line 92
def self.eager_load!
  super

  NumberHelper.eager_load!
end

gem_version()

返回当前加载的 Active Support 版本,作为 Gem::Version

# File activesupport/lib/active_support/gem_version.rb, line 5
def self.gem_version
  Gem::Version.new VERSION::STRING
end

to_time_preserves_timezone()

# File activesupport/lib/active_support.rb, line 112
def self.to_time_preserves_timezone
  DateAndTime::Compatibility.preserve_timezone
end

to_time_preserves_timezone=(value)

# File activesupport/lib/active_support.rb, line 116
def self.to_time_preserves_timezone=(value)
  unless value
    ActiveSupport.deprecator.warn(
      "Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 7.2."
    )
  end

  DateAndTime::Compatibility.preserve_timezone = value
end

utc_to_local_returns_utc_offset_times()

# File activesupport/lib/active_support.rb, line 126
def self.utc_to_local_returns_utc_offset_times
  DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times
end

utc_to_local_returns_utc_offset_times=(value)

# File activesupport/lib/active_support.rb, line 130
def self.utc_to_local_returns_utc_offset_times=(value)
  DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times = value
end

version()

返回当前加载的 Active Support 版本,作为 Gem::Version

# File activesupport/lib/active_support/version.rb, line 7
def self.version
  gem_version
end