Class: Split::User
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #cleanup_old_experiments ⇒ Object
-
#initialize(context) ⇒ User
constructor
A new instance of User.
- #key_without_version(key) ⇒ Object
Constructor Details
#initialize(context) ⇒ User
Returns a new instance of User.
7 8 9 |
# File 'lib/split/user.rb', line 7 def initialize(context) @user = Split::Persistence.adapter.new(context) end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/split/user.rb', line 5 def user @user end |
Instance Method Details
#cleanup_old_experiments ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/split/user.rb', line 11 def cleanup_old_experiments user.keys.each do |key| experiment = ExperimentCatalog.find key_without_version(key) if experiment.nil? || experiment.has_winner? || experiment.start_time.nil? user.delete key end end end |
#key_without_version(key) ⇒ Object
20 21 22 |
# File 'lib/split/user.rb', line 20 def key_without_version(key) key.split(/\:\d(?!\:)/)[0] end |