Class: ElasticAPM::Context::User Private
- Inherits:
-
Object
- Object
- ElasticAPM::Context::User
- Defined in:
- lib/elastic_apm/context/user.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #email ⇒ Object private
- #id ⇒ Object private
- #username ⇒ Object private
Class Method Summary collapse
- .infer(config, record) ⇒ Object private
Instance Method Summary collapse
- #empty? ⇒ Boolean private
-
#initialize(id: nil, email: nil, username: nil) ⇒ User
constructor
private
A new instance of User.
Constructor Details
#initialize(id: nil, email: nil, username: nil) ⇒ User
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of User.
7 8 9 10 11 |
# File 'lib/elastic_apm/context/user.rb', line 7 def initialize(id: nil, email: nil, username: nil) @id = id @email = email @username = username end |
Instance Attribute Details
#email ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/elastic_apm/context/user.rb', line 23 def email @email end |
#id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/elastic_apm/context/user.rb', line 23 def id @id end |
#username ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/elastic_apm/context/user.rb', line 23 def username @username end |
Class Method Details
.infer(config, record) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 17 18 19 20 21 |
# File 'lib/elastic_apm/context/user.rb', line 13 def self.infer(config, record) return unless record new( id: safe_get(record, config.current_user_id_method)&.to_s, email: safe_get(record, config.current_user_email_method), username: safe_get(record, config.current_user_username_method) ) end |
Instance Method Details
#empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/elastic_apm/context/user.rb', line 25 def empty? !id && !email && !username end |