Active Support Configurable¶ ↑
Configurable 提供了一个 config 方法,用于将配置选项存储和检索为 OrderedOptions。
命名空间
方法
- C
实例公共方法
config() 链接
从配置 OrderedOptions 读取和写入属性。
require "active_support/configurable" class User include ActiveSupport::Configurable end user = User.new user.config.allowed_access = true user.config.level = 1 user.config.allowed_access # => true user.config.level # => 1
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/configurable.rb, line 189 def config @_config ||= self.class.config.inheritable_copy end