class HTTP::Message::Array

Public Class Methods

try_convert(value) click to toggle source
# File lib/httpclient/http.rb, line 858
def Array.try_convert(value)
  return value if value.instance_of?(Array)
  return nil if !value.respond_to?(:to_ary)
  converted = value.to_ary
  return converted if converted.instance_of?(Array)

  cname = value.class.name
  raise TypeError, "can't convert %s to %s (%s#%s gives %s)" %
    [cname, Array.name, cname, :to_ary, converted.class.name]
end