Class: Growthbook::InMemoryStickyBucketService
- Inherits:
-
StickyBucketService
- Object
- StickyBucketService
- Growthbook::InMemoryStickyBucketService
- Defined in:
- lib/growthbook/sticky_bucket_service.rb
Overview
Sample implementation (not meant for production use)
Instance Attribute Summary collapse
-
#assignments ⇒ Object
Returns the value of attribute assignments.
Instance Method Summary collapse
- #get_assignments(attribute_name, attribute_value) ⇒ Object
-
#initialize ⇒ InMemoryStickyBucketService
constructor
A new instance of InMemoryStickyBucketService.
- #save_assignments(doc) ⇒ Object
Methods inherited from StickyBucketService
#get_all_assignments, #get_key
Constructor Details
#initialize ⇒ InMemoryStickyBucketService
Returns a new instance of InMemoryStickyBucketService.
32 33 34 35 |
# File 'lib/growthbook/sticky_bucket_service.rb', line 32 def initialize super @assignments = {} end |
Instance Attribute Details
#assignments ⇒ Object
Returns the value of attribute assignments.
30 31 32 |
# File 'lib/growthbook/sticky_bucket_service.rb', line 30 def assignments @assignments end |
Instance Method Details
#get_assignments(attribute_name, attribute_value) ⇒ Object
37 38 39 |
# File 'lib/growthbook/sticky_bucket_service.rb', line 37 def get_assignments(attribute_name, attribute_value) @assignments[get_key(attribute_name, attribute_value)] end |
#save_assignments(doc) ⇒ Object
41 42 43 |
# File 'lib/growthbook/sticky_bucket_service.rb', line 41 def save_assignments(doc) @assignments[get_key(doc['attributeName'], doc['attributeValue'])] = doc end |