Skip to content

Commit

Permalink
Merge pull request #1173 from bf4/comment_private_reader_warnings
Browse files Browse the repository at this point in the history
Comment private accessor warnings
  • Loading branch information
NullVoxPopuli committed Sep 17, 2015
2 parents 61c54bd + c9ae868 commit ee40e9f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/active_model_serializers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee40e9f

Please sign in to comment.