Method: OmfEc::ExperimentProperty#coerce

Defined in:
lib/omf_ec/experiment_property.rb

#coerce(other) ⇒ Object

Explicit Coercion for Integer, Float, and String properties (allow property to be on the right-hand of an operator such as +)



222
223
224
225
226
227
228
229
230
# File 'lib/omf_ec/experiment_property.rb', line 222

def coerce(other)
  if @value.kind_of?(Integer) || @value.kind_of?(Float) || @value.kind_of?(String)
    return other, @value
  else
    raise OEDLCommandException.new("coercion", "Illegal operation, "+
      "The value of Experiment Property '#{@name}' cannot be coerced to allow "+
      " the requested operation (current value is of type #{value.class})")
  end
end