class SentryApi::PageLinks
Parses link header.
@private
Constants
- DELIM_LINKS
- HEADER_LINK
- LINK_REGEX
- METAS
Public Class Methods
new(headers)
click to toggle source
# File lib/sentry-api/page_links.rb, line 13 def initialize(headers) link_header = headers[HEADER_LINK] if link_header && link_header =~ /(previous|next)/ extract_links(link_header) end end
Private Instance Methods
extract_links(header)
click to toggle source
# File lib/sentry-api/page_links.rb, line 23 def extract_links(header) header.split(DELIM_LINKS).each do |link| LINK_REGEX.match(link.strip) do |match| url, meta, results = match[1], match[2], match[3] next if !url or !meta or !(results == "true") or METAS.index(meta).nil? self.send("#{meta}=", url) end end end