mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 06:46:50 +00:00
Merge pull request #1394 from maurogeorge/patch-16
Remove ActiveModelSerializers.silence_warnings dead code
This commit is contained in:
commit
b3bcafcb95
@ -13,39 +13,6 @@ module ActiveModelSerializers
|
|||||||
autoload :Model
|
autoload :Model
|
||||||
autoload :Callbacks
|
autoload :Callbacks
|
||||||
autoload :Logging
|
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
|
end
|
||||||
|
|
||||||
require 'active_model/serializer'
|
require 'active_model/serializer'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user