Module: Redhead

Defined in:
lib/redhead.rb,
lib/redhead/header.rb,
lib/redhead/header_set.rb,
lib/redhead/redhead_string.rb

Defined Under Namespace

Classes: Header, HeaderSet, String

Constant Summary collapse

HEADER_NAME_VALUE_SEPARATOR_CHARACTER =

The character used to separate raw header names from their values.

":"
HEADER_NAME_VALUE_SEPARATOR_PATTERN =

The actual pattern to split header name from value. Uses the above character.

/\s*#{HEADER_NAME_VALUE_SEPARATOR_CHARACTER}\s*/
HEADERS_SEPARATOR =

The separator between header lines and regular body content.

"\n\n"
HEADERS_SEPARATOR_PATTERN =

The actual pattern used to split headers from content.

/\r?\n\r?\n/m
TO_RAW =

The default code to convert a given key to a raw header name.

lambda { |key| key.to_s.split(/_/).map(&:capitalize).join("-") }
TO_KEY =

The default code to convert a given raw header name to a key.

lambda { |raw| raw.split(/[^a-z_]+/i).join("_").downcase.to_sym }