Class: Flagsmith::Engine::Identities::Trait

Inherits:
Object
  • Object
show all
Defined in:
lib/flagsmith/engine/identities/models.rb

Overview

TraitModel

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trait_key:, trait_value:) ⇒ Trait

Returns a new instance of Trait.



62
63
64
65
# File 'lib/flagsmith/engine/identities/models.rb', line 62

def initialize(trait_key:, trait_value:)
  @trait_key = trait_key
  @trait_value = trait_value
end

Instance Attribute Details

#trait_keyObject (readonly) Also known as: key

Returns the value of attribute trait_key.



60
61
62
# File 'lib/flagsmith/engine/identities/models.rb', line 60

def trait_key
  @trait_key
end

#trait_valueObject (readonly) Also known as: value

Returns the value of attribute trait_value.



60
61
62
# File 'lib/flagsmith/engine/identities/models.rb', line 60

def trait_value
  @trait_value
end

Class Method Details

.build(json) ⇒ Object



71
72
73
# File 'lib/flagsmith/engine/identities/models.rb', line 71

def build(json)
  new(**json.slice(:trait_key, :trait_value))
end