Skip to content

Commit

Permalink
Update for review per maurogeorge feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bf4 committed Nov 10, 2015
1 parent 0cde066 commit d4fc811
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/active_model_serializers/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Logging

included do
include ActiveModelSerializers::Callbacks
extend NotificationMacro
extend Macros
instrument_rendering
end

Expand All @@ -25,8 +25,12 @@ def instrument_rendering
end
end

# Macros that can be used to customize the logging of class or instance methods,
# by extending the class or its singleton.
#
# Adapted from:
# https://github.com/rubygems/rubygems/blob/cb28f5e991/lib/rubygems/deprecate.rb
#
# Provides a single method +notify+ to be used to declare when
# something a method notifies, with the argument +callback_name+ of the notification callback.
#
Expand All @@ -39,15 +43,15 @@ def instrument_rendering
# # ...
# end
#
# include ActiveModelSerializers::Logging
# include ActiveModelSerializers::Logging::Macros
# notify :instance_method, :render
#
# class << self
# extend ActiveModelSerializers::Logging::NotificationMacro
# extend ActiveModelSerializers::Logging::Macros
# notify :klass_method, :render
# end
# end
module NotificationMacro
module Macros
##
# Simple notify method that wraps up +name+
# in a dummy method. It notifies on with the +callback_name+ notifier on
Expand Down

0 comments on commit d4fc811

Please sign in to comment.