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 155 def config @_config ||= self.class.config.inheritable_copy end