module Ktistec::Util

Extended Modules

Defined in:

framework/util.cr

Instance Method Summary

Instance Method Detail

def distance_of_time_in_words(from_time : Time, to_time : Time = Time.utc) #

Transforms the span of time between two different times into words.


[View source]
def distance_of_time_in_words(distance : Time::Span) #

Transforms the span of time between two different times into words.


[View source]
def id #

Generates a random, URL-safe identifier.

64 bits should ensure it takes about 5 billion attempts to generate a collision.


[View source]
def pluralize(noun) #

Pluralizes a singular noun.


[View source]
def render_as_text(content) #

Renders content as simple text.


[View source]
def sanitize(content) #

Cleans up the content we receive from others.


[View source]
def to_sentence(array, *, words_connector = ", ", last_word_connector = " and ") #

Converts the array of words to comma-separated sentence form where the last word is joined by a connector word (by default "and").


[View source]