已管理的 deprecator 集合。設定方法(例如 behavior=
)會影響集合中的所有 deprecator。此外,silence
方法會讓集合中所有 deprecator 在特定區塊期間保持靜默。
- #
- B
- D
- E
- N
- S
類別公開方法
new() 連結
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 10 def initialize @options = {} @deprecators = {} end
實例公開方法
[](name) 連結
傳回透過 []=
新增到此集合的 deprecator。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 16 def [](name) @deprecators[name] end
[]=(name, deprecator) 連結
將指定的 deprecator
新增到此集合。此 deprecator 會立即設定為此集合先前設定的任何選項。
deprecators = ActiveSupport::Deprecation::Deprecators.new
deprecators.debug = true
foo_deprecator = ActiveSupport::Deprecation.new("2.0", "Foo")
foo_deprecator.debug # => false
deprecators[:foo] = foo_deprecator
deprecators[:foo].debug # => true
foo_deprecator.debug # => true
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 34 def []=(name, deprecator) apply_options(deprecator) @deprecators[name] = deprecator end
behavior=(behavior) 連結
設定此集合中所有非建議使用的警告行為。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 60 def behavior=(behavior) set_option(:behavior, behavior) end
debug=(debug) 連結
設定此集合中所有非建議使用的偵錯旗標。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 52 def debug=(debug) set_option(:debug, debug) end
disallowed_behavior=(disallowed_behavior) 連結
設定此集合中所有非建議使用的警告行為。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 68 def disallowed_behavior=(disallowed_behavior) set_option(:disallowed_behavior, disallowed_behavior) end
disallowed_warnings=(disallowed_warnings) 連結
設定此集合中所有非建議使用的警告。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 76 def disallowed_warnings=(disallowed_warnings) set_option(:disallowed_warnings, disallowed_warnings) end
each(&block) 連結
反覆處理此集合中的所有非建議使用。如果沒有給定區塊,則傳回 Enumerator
。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 41 def each(&block) return to_enum(__method__) unless block @deprecators.each_value(&block) end
silence(&block) 連結
在給定區塊持續時間內,讓此集合中的所有非建議使用保持靜默。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 84 def silence(&block) each { |deprecator| deprecator.begin_silence } block.call ensure each { |deprecator| deprecator.end_silence } end
silenced=(silenced) 連結
設定此集合中所有棄用警告的 silenced 標記。
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 47 def silenced=(silenced) set_option(:silenced, silenced) end