Class: Opbeat::ErrorMessage::User
- Defined in:
- lib/opbeat/error_message/user.rb
Constant Summary collapse
- CONTROLLER_KEY =
'action_controller.instance'.freeze
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_authenticated ⇒ Object
Returns the value of attribute is_authenticated.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Methods inherited from Struct
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email
3 4 5 |
# File 'lib/opbeat/error_message/user.rb', line 3 def email @email end |
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/opbeat/error_message/user.rb', line 3 def id @id end |
#is_authenticated ⇒ Object
Returns the value of attribute is_authenticated
3 4 5 |
# File 'lib/opbeat/error_message/user.rb', line 3 def is_authenticated @is_authenticated end |
#username ⇒ Object
Returns the value of attribute username
3 4 5 |
# File 'lib/opbeat/error_message/user.rb', line 3 def username @username end |
Class Method Details
.from_rack_env(config, env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/opbeat/error_message/user.rb', line 6 def self.from_rack_env config, env controller = env[CONTROLLER_KEY] method = config.current_user_method.to_sym return unless controller && controller.respond_to?(method) user = controller.send method new( true, user.respond_to?(:id) ? user.id : nil, user.respond_to?(:username) ? user.username : nil, user.respond_to?(:email) ? user.email : nil ) end |