Sha256: a5baf44dcee7a8fb7e2c7f981e3ac6f42a0562039a48aa7335160bfe323b96bb
Contents?: true
Size: 454 Bytes
Versions: 2
Compression:
Stored size: 454 Bytes
Contents
module RestCore module 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rest-core-4.0.1 | lib/rest-core/util/parse_link.rb |
rest-core-4.0.0 | lib/rest-core/util/parse_link.rb |