Merge pull request #1173 from bf4/comment_private_reader_warnings

Comment private accessor warnings
This commit is contained in:
L. Preston Sego III 2015-09-17 15:35:45 -04:00
commit ee40e9fcef

View File

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