Class: TestTrack::Assignment

Inherits:
Object
  • Object
show all
Includes:
RequiredOptions
Defined in:
app/models/test_track/assignment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Assignment

Returns a new instance of Assignment.

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'app/models/test_track/assignment.rb', line 8

def initialize(opts = {})
  @visitor = require_option!(opts, :visitor)
  @split_name = require_option!(opts, :split_name).to_s
  raise ArgumentError, "unknown opts: #{opts.keys.to_sentence}" if opts.present?
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



4
5
6
# File 'app/models/test_track/assignment.rb', line 4

def context
  @context
end

#split_nameObject (readonly)

Returns the value of attribute split_name.



5
6
7
# File 'app/models/test_track/assignment.rb', line 5

def split_name
  @split_name
end

#variantObject



14
15
16
# File 'app/models/test_track/assignment.rb', line 14

def variant
  @variant ||= _variant
end

#visitorObject (readonly)

Returns the value of attribute visitor.



5
6
7
# File 'app/models/test_track/assignment.rb', line 5

def visitor
  @visitor
end

Instance Method Details

#feature_gate?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/test_track/assignment.rb', line 22

def feature_gate?
  split_name.end_with?('_enabled')
end

#unsynced?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/test_track/assignment.rb', line 18

def unsynced?
  true
end