Class: InfluxReporter::ErrorMessage::User
- Inherits:
-
Struct
- Object
- Struct
- InfluxReporter::ErrorMessage::User
- Defined in:
- lib/influx_reporter/error_message/user.rb
Constant Summary collapse
- CONTROLLER_KEY =
'action_controller.instance'
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
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email
5 6 7 |
# File 'lib/influx_reporter/error_message/user.rb', line 5 def email @email end |
#id ⇒ Object
Returns the value of attribute id
5 6 7 |
# File 'lib/influx_reporter/error_message/user.rb', line 5 def id @id end |
#is_authenticated ⇒ Object
Returns the value of attribute is_authenticated
5 6 7 |
# File 'lib/influx_reporter/error_message/user.rb', line 5 def is_authenticated @is_authenticated end |
#username ⇒ Object
Returns the value of attribute username
5 6 7 |
# File 'lib/influx_reporter/error_message/user.rb', line 5 def username @username end |
Class Method Details
.from_rack_env(config, env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/influx_reporter/error_message/user.rb', line 8 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 |