From c9ae868bfba1d26ffcd7d146bd6d04a1c829c2bc Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Thu, 17 Sep 2015 14:32:22 -0500 Subject: [PATCH] Comment private accessor warnings --- lib/active_model_serializers.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/active_model_serializers.rb b/lib/active_model_serializers.rb index 38fc5e145..d8a79f8d9 100644 --- a/lib/active_model_serializers.rb +++ b/lib/active_model_serializers.rb @@ -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