Class: Gitlab::Experimentation::Experiment

Inherits:
Struct
  • Object
show all
Defined in:
lib/gitlab/experimentation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#environmentObject

Returns the value of attribute environment

Returns:

  • (Object)

    the current value of environment


192
193
194
# File 'lib/gitlab/experimentation.rb', line 192

def environment
  @environment
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key


192
193
194
# File 'lib/gitlab/experimentation.rb', line 192

def key
  @key
end

#tracking_categoryObject

Returns the value of attribute tracking_category

Returns:

  • (Object)

    the current value of tracking_category


192
193
194
# File 'lib/gitlab/experimentation.rb', line 192

def tracking_category
  @tracking_category
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)

193
194
195
# File 'lib/gitlab/experimentation.rb', line 193

def enabled?
  experiment_percentage > 0
end

#enabled_for_environment?Boolean

Returns:

  • (Boolean)

197
198
199
200
201
# File 'lib/gitlab/experimentation.rb', line 197

def enabled_for_environment?
  return ::Gitlab.dev_env_or_com? if environment.nil?

  environment
end

#enabled_for_experimentation_subject?(experimentation_subject_index) ⇒ Boolean

Returns:

  • (Boolean)

203
204
205
206
207
# File 'lib/gitlab/experimentation.rb', line 203

def enabled_for_experimentation_subject?(experimentation_subject_index)
  return false if experimentation_subject_index.blank?

  experimentation_subject_index <= experiment_percentage
end