Class: Hackle::RemoteConfigEvaluation

Inherits:
EvaluatorEvaluation show all
Defined in:
lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb

Instance Attribute Summary collapse

Attributes inherited from EvaluatorEvaluation

#reason, #target_evaluations

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason:, target_evaluations:, parameter:, value_id:, value:, properties:) ⇒ RemoteConfigEvaluation

Returns a new instance of RemoteConfigEvaluation.

Parameters:



140
141
142
143
144
145
146
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 140

def initialize(reason:, target_evaluations:, parameter:, value_id:, value:, properties:)
  super(reason: reason, target_evaluations: target_evaluations)
  @parameter = parameter
  @value_id = value_id
  @value = value
  @properties = properties
end

Instance Attribute Details

#parameterRemoteConfigParameter (readonly)



123
124
125
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 123

def parameter
  @parameter
end

#propertiesHash<String => Object> (readonly)

Returns:

  • (Hash<String => Object>)


132
133
134
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 132

def properties
  @properties
end

#valueObject (readonly)

Returns:

  • (Object)


129
130
131
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 129

def value
  @value
end

#value_idInteger? (readonly)

Returns:

  • (Integer, nil)


126
127
128
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 126

def value_id
  @value_id
end

Class Method Details

.create(request, context, value_id, value, reason, properties_builder) ⇒ Object

Parameters:



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 154

def self.create(request, context, value_id, value, reason, properties_builder)
  properties_builder.add('returnValue', value)
  RemoteConfigEvaluation.new(
    reason: reason,
    target_evaluations: context.evaluations,
    parameter: request.parameter,
    value_id: value_id,
    value: value,
    properties: properties_builder.build
  )
end

.create_default(request, context, reason, properties_builder) ⇒ Object

Parameters:



170
171
172
# File 'lib/hackle/internal/evaluation/evaluator/remoteconfig/remote_config_evaluator.rb', line 170

def self.create_default(request, context, reason, properties_builder)
  create(request, context, nil, request.default_value, reason, properties_builder)
end