Sha256: 9421db2dcfe509dca1646fa0d83a4f7dbe191f902fe5d76285bb4a6214a8a2d0

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

class Verdict::StaticSegmenter < Verdict::Segmenter

  class Group < Verdict::Group

    attr_reader :subject_identifiers

    def initialize(experiment, handle, subject_identifiers)
      super(experiment, handle)
      @subject_identifiers = subject_identifiers
    end

    def as_json(options = {})
      super(options).merge(subject_identifiers: subject_identifiers)
    end
  end

  def register_group(handle, subject_identifiers)
    Group.new(experiment, handle, subject_identifiers)
  end

  def assign(identifier, subject, context)
    groups.values.find { |group| group.subject_identifiers.include?(identifier) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
verdict-0.2.0 lib/verdict/static_segmenter.rb