lib/verdict/assignment.rb in verdict-0.1.1 vs lib/verdict/assignment.rb in verdict-0.2.0
- old
+ new
@@ -1,22 +1,31 @@
class Verdict::Assignment
attr_reader :experiment, :subject_identifier, :group, :created_at
- def initialize(experiment, subject_identifier, group, originally_created_at)
+ def initialize(experiment, subject_identifier, group, originally_created_at, temporary = false)
@experiment = experiment
@subject_identifier = subject_identifier
@group = group
@returning = !originally_created_at.nil?
@created_at = originally_created_at || Time.now.utc
+ @temporary = temporary
end
def subject
@subject ||= experiment.fetch_subject(subject_identifier)
end
def qualified?
!group.nil?
+ end
+
+ def permanent?
+ !@temporary
+ end
+
+ def temporary?
+ @temporary
end
def returning
self.class.new(@experiment, @subject_identifier, @group, @created_at)
end