Ktistec::Util
Constants
The maximum length of a slug, in codepoints.
Instance methods
Transforms the span of time between two different times into words.
Transforms the span of time between two different times into words.
Transforms a duration into words, adapting the unit (minutes, hours, or days) to the magnitude of the duration.
Generates a summary from long content.
Whitespace is collapsed and the result is a single line.
Generates a random, URL-safe identifier.
64 bits should ensure it takes about 5 billion attempts to generate a collision.
Returns the origin of the given URI.
An origin is the scheme, host and port, as defined by RFC 6454 and required by FEP-fe34.
Returns nil if the URI cannot be parsed, if it does not
specify both a scheme and a host, or if the scheme is not one
an IRI may use.
Returns the link to the quoted post that servers include for clients that don't render quotes.
Renders content as simple text and truncates to the given length.
Returns true if both URIs have the same, non-nil origin.
See origin?.
Cleans up the content we receive from others.
Generates a slug from a name.
An all-digit slug is prefixed, so that it can never be mistaken for a database id.
Converts the array of words to comma-separated sentence form where the last word is joined by a connector word (by default "and").
Wraps a URL in a link, in the format used by Mastodon: https://github.com/mastodon/mastodon/blob/main/app/lib/text_formatter.rb
Returns the wrapped HTML when str is a structurally-wrappable
URL (parses with scheme/host/path and passes safe_url?).
Returns nil otherwise.