def apply_transform(key, value, type)
      if type
        if respond_to?("convert_#{type}", true)
          send("convert_#{type}", key, value)
        else
          send(type, value)
        end
      else
        value
      end
    end
def apply_transform(key, value, type)
      if type
        if respond_to?("convert_#{type}", true)
          send("convert_#{type}", key, value)
        else
          send(type, value)
        end
      else
        value
      end
    end
Applies URI value transformation by either using the default cast
 or a transformation appropriate for the given type.

 @param key [String] URI option name.
 @param value [String] The value to be transformed.
 @param type [Symbol] The transform method.