Class: Gitlab::PageLinks

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/page_links.rb

Overview

Parses link header.

Constant Summary collapse

'Link'
','
/<([^>]+)>; rel="([^"]+)"/.freeze
METAS =
%w[last next first prev].freeze

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ PageLinks

Returns a new instance of PageLinks.



15
16
17
18
19
# File 'lib/gitlab/page_links.rb', line 15

def initialize(headers)
  link_header = headers[HEADER_LINK]

  extract_links(link_header) if link_header && link_header =~ /(next|first|last|prev)/
end