module Crysterm::Helpers

Overview

Mixin containing helper functions

Direct including types

Defined in:

helpers.cr

Instance Method Summary

Instance Method Detail

def asort(obj) #

Sorts array alphabetically by first letter of property 'name'.


[View source]
def clean_tags(text) #

Strips text of {...} tags and SGR sequences


[View source]
def drop_unicode(text) #

Drops any >U+FFFF characters in the text.


[View source]
def escape(text) #

Escapes text for tag-enabled elements where one does not want the tags enclosed in {...} to be treated specially, but literally.

Example to print literal "{bold}{/bold}": ''' box.set_content("escaped content: " + escape("{bold}{/bold}")) '''


[View source]
def find_file(start, target) #

Finds a file with name 'target' inside toplevel directory 'start'. XXX Possibly replace with github: mlobl/finder


[View source]
def hsort(obj) #

Sorts array numerically by property 'index'


[View source]
def strip_tags(text : String) #

Strips text of "{...}" tags and SGR sequences and removes leading/trailing whitespaces


[View source]