def format(value, name = nil, style = nil)
      name  ||= self.name
      style ||= self.style

      value = fixed if fixed
      value ||= default if default

      unless value
        if required?
          raise ArgumentError, %Q{No value provided for required param "#{name}"!}
        else
          return '' # No value provided and none required.
        end
      end

      if value.respond_to?(:each) && !value.respond_to?(:to_str)
        if repeating?
          values = value
        else
          raise ArgumentError, %Q{Multiple values provided for single-value param "#{name}"}
        end
      else
        values = [value]
      end

      # If the param lists acceptable values in option tags, make sure that
      # all values are found in those tags.
      if options && !options.empty?
        values.each { |_value|
          unless find_option(_value)
            acceptable = options.map { |o| o.value }.join('", "')
            raise ArgumentError, %Q{"#{_value}" is not among the acceptable parameter values ("#{acceptable}")}
          end
        }
      end

      if style == 'query' || parent.is_a?(RequestFormat) || (
        parent.respond_to?(:is_form_representation?) && parent.is_form_representation?
      )
        values.map { |v| "#{uri_escape(name)}=#{uri_escape(v.to_s)}" }.join('&')
      elsif style == 'matrix'
        if type == 'xsd:boolean'
          values.map { |v| ";#{name}" if v =~ BOOLEAN_RE }.compact.join
        else
          values.map { |v| ";#{uri_escape(name)}=#{uri_escape(v.to_s)}" if v }.compact.join
        end
      elsif style == 'header'
        values.join(',')
      else
        # All other cases: plain text representation.
        values.map { |v| uri_escape(v.to_s) }.join(',')
      end
    end
def format(value, name = nil, style = nil)
      name  ||= self.name
      style ||= self.style

      value = fixed if fixed
      value ||= default if default

      unless value
        if required?
          raise ArgumentError, %Q{No value provided for required param "#{name}"!}
        else
          return '' # No value provided and none required.
        end
      end

      if value.respond_to?(:each) && !value.respond_to?(:to_str)
        if repeating?
          values = value
        else
          raise ArgumentError, %Q{Multiple values provided for single-value param "#{name}"}
        end
      else
        values = [value]
      end

      # If the param lists acceptable values in option tags, make sure that
      # all values are found in those tags.
      if options && !options.empty?
        values.each { |_value|
          unless find_option(_value)
            acceptable = options.map { |o| o.value }.join('", "')
            raise ArgumentError, %Q{"#{_value}" is not among the acceptable parameter values ("#{acceptable}")}
          end
        }
      end

      if style == 'query' || parent.is_a?(RequestFormat) || (
        parent.respond_to?(:is_form_representation?) && parent.is_form_representation?
      )
        values.map { |v| "#{uri_escape(name)}=#{uri_escape(v.to_s)}" }.join('&')
      elsif style == 'matrix'
        if type == 'xsd:boolean'
          values.map { |v| ";#{name}" if v =~ BOOLEAN_RE }.compact.join
        else
          values.map { |v| ";#{uri_escape(name)}=#{uri_escape(v.to_s)}" if v }.compact.join
        end
      elsif style == 'header'
        values.join(',')
      else
        # All other cases: plain text representation.
        values.map { |v| uri_escape(v.to_s) }.join(',')
      end
    end
Validates and formats a proposed value for this parameter. Returns
 the formatted value. Raises an ArgumentError if the value
 is invalid.

 The 'name' and 'style' arguments are used in conjunction with the
 default Param object.