Module: ExceptionHunter::UserAttributesCollector
- Extended by:
- UserAttributesCollector
- Included in:
- UserAttributesCollector
- Defined in:
- lib/exception_hunter/user_attributes_collector.rb
Overview
Utility module used to whitelist the user's attributes. Can be configured in ExceptionHunter.setup to extract custom attributes.
Class Method Summary collapse
-
.collect_attributes(user) ⇒ Hash
Gets the attributes configured for the user.
Instance Method Summary collapse
-
#collect_attributes(user) ⇒ Hash
Gets the attributes configured for the user.
Class Method Details
.collect_attributes(user) ⇒ Hash
Gets the attributes configured for the user.
22 23 24 25 26 27 28 |
# File 'lib/exception_hunter/user_attributes_collector.rb', line 22 def collect_attributes(user) return {} unless user attributes.reduce({}) do |data, attribute| data.merge(attribute => user.try(attribute)) end end |
Instance Method Details
#collect_attributes(user) ⇒ Hash
Gets the attributes configured for the user.
22 23 24 25 26 27 28 |
# File 'lib/exception_hunter/user_attributes_collector.rb', line 22 def collect_attributes(user) return {} unless user attributes.reduce({}) do |data, attribute| data.merge(attribute => user.try(attribute)) end end |