Module: Noko::LinkHeader

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

Overview

:nodoc:

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#parse(string) ⇒ Object



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

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