Comment private accessor warnings

This commit is contained in:
Benjamin Fleischer 2015-09-17 14:32:22 -05:00
parent 61c54bddcd
commit c9ae868bfb

View File

@ -9,6 +9,27 @@ module ActiveModelSerializers
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
# ```
def silence_warnings
verbose = $VERBOSE
$VERBOSE = nil