Sha256: 8231db221cf7cf20c4562c3c03ceb1159a3a083a51d3e83f0be768f79729ca54

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

require "forwardable"

require_relative "link_header_parser/version"

require_relative "link_header_parser/link_header"
require_relative "link_header_parser/link_header_parameter"
require_relative "link_header_parser/link_headers_collection"

module LinkHeaderParser
  # Parse an array of HTTP Link headers.
  #
  # Convenience method for {LinkHeaderParser::LinkHeadersCollection#initialize}.
  #
  # @example
  #   require "net/http"
  #
  #   url = "https://sixtwothree.org"
  #   link_headers = Net::HTTP.get_response(URI.parse(url)).get_fields("Link")
  #
  #   LinkHeaderParser.parse(link_headers, base: url)
  #
  # @param (see LinkHeaderParser::LinkHeadersCollection#initialize)
  # @return (see LinkHeaderParser::LinkHeadersCollection#initialize)
  def self.parse(*headers, base:)
    LinkHeadersCollection.new(*headers, base: base)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
link-header-parser-5.1.1 lib/link-header-parser.rb
link-header-parser-5.1.0 lib/link-header-parser.rb
link-header-parser-5.0.1 lib/link-header-parser.rb