Module: BrightSerializer::Extensions::Instrumentation

Defined in:
lib/bright_serializer/extensions/instrumentation.rb

Constant Summary collapse

SERIALIZABLE_HASH_NOTIFICATION =
'render.bright_serializer.serializable_hash'
SERIALIZED_JSON_NOTIFICATION =
'render.bright_serializer.serializable_json'

Instance Method Summary collapse

Instance Method Details

#serializable_hashObject Also known as: to_hash



9
10
11
12
13
# File 'lib/bright_serializer/extensions/instrumentation.rb', line 9

def serializable_hash
  ActiveSupport::Notifications.instrument(SERIALIZABLE_HASH_NOTIFICATION, serializer: self.class.name) do
    super
  end
end

#serializable_json(*_args) ⇒ Object Also known as: to_json



17
18
19
20
21
# File 'lib/bright_serializer/extensions/instrumentation.rb', line 17

def serializable_json(*_args)
  ActiveSupport::Notifications.instrument(SERIALIZED_JSON_NOTIFICATION, serializer: self.class.name) do
    super
  end
end