Sha256: e979f8ff0d6b225f984845ed83ef1b76cb6ca639f0f815f122c1e1f9657169b1
Contents?: true
Size: 437 Bytes
Versions: 15
Compression:
Stored size: 437 Bytes
Contents
module RestCore; end module RestCore::ParseLink module_function # http://tools.ietf.org/html/rfc5988 parname = '"?([^"]+)"?' LINKPARAM = /#{parname}=#{parname}/ def parse_link link link.split(',').inject({}) do |r, value| uri, *pairs = value.split(';') params = Hash[pairs.map{ |p| p.strip.match(LINKPARAM)[1..2] }] r[params['rel']] = params.merge('uri' => uri[/<([^>]+)>/, 1]) r end end end
Version data entries
15 entries across 15 versions & 1 rubygems