class ElasticAPM::Context::User
@api private
Attributes
email[RW]
id[RW]
username[RW]
Public Class Methods
infer(config, record)
click to toggle source
# File lib/elastic_apm/context/user.rb, line 12 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
new(id: nil, email: nil, username: nil)
click to toggle source
# File lib/elastic_apm/context/user.rb, line 6 def initialize(id: nil, email: nil, username: nil) @id = id @email = email @username = username end
Private Class Methods
safe_get(record, method_name)
click to toggle source
# File lib/elastic_apm/context/user.rb, line 35 def safe_get(record, method_name) record.respond_to?(method_name) ? record.send(method_name) : nil end
Public Instance Methods
any?()
click to toggle source
# File lib/elastic_apm/context/user.rb, line 28 def any? !empty? end
empty?()
click to toggle source
# File lib/elastic_apm/context/user.rb, line 24 def empty? !id && !email && !username end