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
- #any? ⇒ Boolean private
- #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.
24 25 26 27 28 |
# File 'lib/elastic_apm/context/user.rb', line 24 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.
40 41 42 |
# File 'lib/elastic_apm/context/user.rb', line 40 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.
40 41 42 |
# File 'lib/elastic_apm/context/user.rb', line 40 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.
40 41 42 |
# File 'lib/elastic_apm/context/user.rb', line 40 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.
30 31 32 33 34 35 36 37 38 |
# File 'lib/elastic_apm/context/user.rb', line 30 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
#any? ⇒ 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.
46 47 48 |
# File 'lib/elastic_apm/context/user.rb', line 46 def any? !empty? end |
#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.
42 43 44 |
# File 'lib/elastic_apm/context/user.rb', line 42 def empty? !id && !email && !username end |