Class: Determinator::FixedDetermination

Inherits:
Object
  • Object
show all
Defined in:
lib/determinator/fixed_determination.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature_on:, variant:, name: '', constraints: {}) ⇒ FixedDetermination

Returns a new instance of FixedDetermination.



5
6
7
8
9
10
# File 'lib/determinator/fixed_determination.rb', line 5

def initialize(feature_on:, variant:, name: '', constraints: {})
  @name = name
  @feature_on = feature_on
  @variant = variant
  @constraints = constraints
end

Instance Attribute Details

#constraintsObject (readonly)

Returns the value of attribute constraints.



3
4
5
# File 'lib/determinator/fixed_determination.rb', line 3

def constraints
  @constraints
end

#feature_onObject (readonly)

Returns the value of attribute feature_on.



3
4
5
# File 'lib/determinator/fixed_determination.rb', line 3

def feature_on
  @feature_on
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/determinator/fixed_determination.rb', line 3

def name
  @name
end

#variantObject (readonly)

Returns the value of attribute variant.



3
4
5
# File 'lib/determinator/fixed_determination.rb', line 3

def variant
  @variant
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
23
# File 'lib/determinator/fixed_determination.rb', line 20

def ==(other)
  return false unless other.is_a?(self.class)
  other.feature_on == feature_on && other.variant == variant && other.constraints == constraints
end

#inspectObject



12
13
14
# File 'lib/determinator/fixed_determination.rb', line 12

def inspect
  "<feature_on: #{feature_on}, variant: #{variant}, constraints: #{constraints}"
end

#to_explain_paramsObject



16
17
18
# File 'lib/determinator/fixed_determination.rb', line 16

def to_explain_params
  { name: name }
end