Module: Noko::LinkHeader

Extended by:
LinkHeader
Included in:
LinkHeader
Defined in:
lib/noko/link_header.rb

Constant Summary collapse

REGEXP =
/<([^>]+)>; rel="(\w+)"/

Instance Method Summary collapse

Instance Method Details

#parse(string) ⇒ Object



9
10
11
12
13
# File 'lib/noko/link_header.rb', line 9

def parse(string)
  string.scan(REGEXP).each_with_object(Noko::Record.new) do |(uri, rel), record|
    record[rel.to_sym] = URI.parse(uri).request_uri
  end
end