Sha256: 0eacf87e2add6a6642507628474a8b825d759341a628d5b9ebd5d6d28077df7a

Contents?: true

Size: 876 Bytes

Versions: 32

Compression:

Stored size: 876 Bytes

Contents

module SplitIoClient

  #
  # represents the possible return values for a treatment
  #
  class Treatments < NoMethodError

    # Constants to represent treatment values
    CONTROL = 'control'
    OFF = 'off'
    ON = 'on'

    # get the actual value for the given treatment type
    #
    # @param type [string] treatment type
    #
    # @return [Treatment] treatment type value
    def self.get_type(type)
      case type
        when 'on'
          return ON
        when 'off', 'control'
          return CONTROL
        else # default return off
          return CONTROL
      end
    end

    # checks if the give treatment matches control type
    #
    # @param type [string] treatment type
    #
    # @return [boolean] true if matches, false otherwise
    def self.is_control?(treatment)
      get_type(treatment).equal?(CONTROL) ? true : false
    end

  end

end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
splitclient-rb-3.1.2 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.1 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc12 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc11 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc10 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc9 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc8 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc7 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc6 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc5 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc4 lib/engine/partitions/treatments.rb
splitclient-rb-3.1.0.pre.rc2 lib/engine/partitions/treatments.rb
splitclient-rb-3.0.3 lib/engine/partitions/treatments.rb
splitclient-rb-3.0.3.pre.rc2 lib/engine/partitions/treatments.rb
splitclient-rb-3.0.3.pre.rc1 lib/engine/partitions/treatments.rb
splitclient-rb-3.0.2 lib/engine/partitions/treatments.rb
splitclient-rb-2.0.1 lib/splitclient-engine/partitions/treatments.rb
splitclient-rb-2.0.0 lib/splitclient-engine/partitions/treatments.rb
splitclient-rb-1.0.4 lib/splitclient-engine/partitions/treatments.rb