mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #1173 from bf4/comment_private_reader_warnings
Comment private accessor warnings
This commit is contained in:
commit
ee40e9fcef
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user