Merge pull request #1394 from maurogeorge/patch-16

Remove ActiveModelSerializers.silence_warnings dead code
This commit is contained in:
Benjamin Fleischer 2015-12-24 11:35:55 -06:00
commit b3bcafcb95

View File

@ -13,39 +13,6 @@ module ActiveModelSerializers
autoload :Model
autoload :Callbacks
autoload :Logging
module_function
# @note
# ```ruby
# private
#
# attr_reader :resource, :adapter_opts, :serializer_opts
# ```
#
# Will generate a warning, though it shouldn't.
# There's a bug in Ruby for this: https://bugs.ruby-lang.org/issues/10967
#
# We can use +ActiveModelSerializers.silence_warnings+ as a
# 'safety valve' for unfixable or not-worth-fixing warnings,
# and keep our app warning-free.
#
# ```ruby
# private
#
# ActiveModelSerializers.silence_warnings do
# attr_reader :resource, :adapter_opts, :serializer_opts
# end
# ```
#
# or, as specific stopgap, define the attrs in the protected scope.
def silence_warnings
verbose = $VERBOSE
$VERBOSE = nil
yield
ensure
$VERBOSE = verbose
end
end
require 'active_model/serializer'