方法
- #
- B
- D
- E
- N
- S
类公共方法
new() 链接
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 10 def initialize @options = {} @deprecators = {} end
实例公共方法
[](name) 链接
返回通过 []= 添加到此集合中的已弃用警告。
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 16 def [](name) @deprecators[name] end
[]=(name, 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) 链接
为集合中的所有已弃用警告设置静默标志。
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/deprecation/deprecators.rb, line 47 def silenced=(silenced) set_option(:silenced, silenced) end