class LinkHeader
- LinkHeader
- Reference
- Object
Defined in:
link-header.crConstant Summary
-
ATTR =
/#{TOKEN} *= *(#{TOKEN}|#{QUOTED}) */
-
COMMA =
/, */
-
HREF =
/\ *< *([^>]*) *> *;? */
-
Regexes for link header parsing. TOKEN and QUOTED in particular should conform to RFC2616.
Acknowledgement: The QUOTED regexp is based on http://stackoverflow.com/questions/249791/regexp-for-quoted-string-with-escaping-quotes/249937#249937
-
QUOTED =
/"((?:[^"\\]|\\.)*)"/
-
SEMI =
/; */
-
TOKEN =
/([^()<>@,;:\"\[\]?={}\s]+)/
Constructors
- .new(links : Hash(String, Hash(String, String)))
- .new(link_header : String)
- .new(headers : HTTP::Headers)
- .new(response : HTTP::Client::Response)
- .new
Class Method Summary
- .parse(headers : HTTP::Headers) : Hash(String, Hash(String, String))
- .parse(link_header : String) : Hash(String, Hash(String, String))
Instance Method Summary
-
#[](key : String) : String
shortcut for looking up links matching rel
- #[]?(key : String) : String | Nil
- #add(link : String, keys : Hash(String, String))
- #fetch(key : String, &)
- #fetch(key : String, default)
- #get(key : String)
- #links : Hash(String, Hash(String, String))
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
Constructor Detail
Class Method Detail
Instance Method Detail
def to_s(io : IO) : Nil
#
Description copied from class Reference
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>