class HttpHeaders::Link

Constants

VERSION

Attributes

lookup[RW]

Public Class Methods

new(value) click to toggle source
# File lib/http_headers/link.rb, line 6
def initialize(value)
  __setobj__ HttpHeaders::Utils::List.new(value, entry_klazz: Link::Entry)
  indexify!
end

Public Instance Methods

[](name) click to toggle source
# File lib/http_headers/link.rb, line 12
def [](name)
  lookup.fetch(String(name).to_sym) do
    indexed(name)
  end
end
Also aliased as: indexed
indexed(name)
Alias for: []

Private Instance Methods

indexify!() click to toggle source
# File lib/http_headers/link.rb, line 58
def indexify!
  self.lookup = each_with_object({}) do |entry, result|
    result[entry.rel&.to_sym] = entry
  end
end