Sha256: 7bb8148825e9197e7ee35154c261fcb80be043f5ce607637af9474f237255a27
Contents?: true
Size: 587 Bytes
Versions: 3
Compression:
Stored size: 587 Bytes
Contents
# frozen_string_literal: true module ElasticAPM class Context # @api private class User def initialize(config, record) return unless record @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 attr_accessor :id, :email, :username private def safe_get(record, method_name) record.respond_to?(method_name) ? record.send(method_name) : nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
elastic-apm-2.1.2 | lib/elastic_apm/context/user.rb |
elastic-apm-2.1.1 | lib/elastic_apm/context/user.rb |
elastic-apm-2.1.0 | lib/elastic_apm/context/user.rb |