Method: Optimizely::Project#get_feature_variable_double

Defined in:
lib/optimizely.rb

#get_feature_variable_double(feature_flag_key, variable_key, user_id, attributes = nil) ⇒ Boolean?

Get the Double value of the specified variable in the feature flag.

Parameters:

  • feature_flag_key
    • String key of feature flag the variable belongs to

  • variable_key
    • String key of variable for which we are getting the string value

  • user_id
    • String user ID

  • attributes (defaults to: nil)
    • Hash representing visitor attributes and values which need to be recorded.

Returns:

  • (Boolean)

    the double variable value.

  • (nil)

    if the feature flag or variable are not found.



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
# File 'lib/optimizely.rb', line 713

def get_feature_variable_double(feature_flag_key, variable_key, user_id, attributes = nil)
  unless is_valid
    @logger.log(Logger::ERROR, InvalidProjectConfigError.new('get_feature_variable_double').message)
    return nil
  end

  variable_value = get_feature_variable_for_type(
    feature_flag_key,
    variable_key,
    Optimizely::Helpers::Constants::VARIABLE_TYPES['DOUBLE'],
    user_id,
    attributes
  )

  variable_value
end