class ConfigCat::User

Constants

PREDEFINED

The user object for variation evaluation

Public Class Methods

new(identifier, email: nil, country: nil, custom: nil) click to toggle source
# File lib/configcat/user.rb, line 10
def initialize(identifier, email: nil, country: nil, custom: nil)
  @__identifier = (!identifier.equal?(nil)) ? identifier : ""
  @__data = {"Identifier" => identifier, "Email" => email, "Country" => country}
  @__custom = custom
end

Public Instance Methods

get_attribute(attribute) click to toggle source
# File lib/configcat/user.rb, line 20
def get_attribute(attribute)
  attribute = attribute.to_s
  if PREDEFINED.include?(attribute)
    return @__data[attribute]
  end

  if !@__custom.equal?(nil)
    @__custom.each do |customField, customValue|
      if customField.to_s == attribute
        return customValue
      end
    end
  end
  return nil
end
get_identifier() click to toggle source
# File lib/configcat/user.rb, line 16
def get_identifier()
  return @__identifier
end