Sha256: 6de8877e1271bf1fcd5e740992a2a7e475f0e98dc6dc0efe3532b7c8c63b6e16

Contents?: true

Size: 736 Bytes

Versions: 24

Compression:

Stored size: 736 Bytes

Contents

module Verdict
  module Segmenters
    class StaticSegmenter < BaseSegmenter

      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

      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
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
verdict-0.16.1 lib/verdict/segmenters/static_segmenter.rb
verdict-0.16.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.15.2 lib/verdict/segmenters/static_segmenter.rb
verdict-0.15.1 lib/verdict/segmenters/static_segmenter.rb
verdict-0.15.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.14.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.13.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.12.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.11.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.10.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.9.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.8.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.7.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.6.3 lib/verdict/segmenters/static_segmenter.rb
verdict-0.6.2 lib/verdict/segmenters/static_segmenter.rb
verdict-0.6.1 lib/verdict/segmenters/static_segmenter.rb
verdict-0.6.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.5.0 lib/verdict/segmenters/static_segmenter.rb
verdict-0.4.1 lib/verdict/segmenters/static_segmenter.rb
verdict-0.4.0 lib/verdict/segmenters/static_segmenter.rb