Class: String

Inherits:
Object show all
Includes:
Doing::ChronifyString, Doing::Color, Doing::Completion::StringUtils, Doing::StringHighlight, Doing::StringNormalize, Doing::StringQuery, Doing::StringTags, Doing::StringTransform, Doing::StringTruncate, Doing::StringURL
Defined in:
lib/doing/good.rb,
lib/doing/colors.rb,
lib/doing/normalize.rb,
lib/doing/string/string.rb,
lib/doing/chronify/chronify.rb,
lib/doing/completion/fig_completion.rb,
lib/doing/completion/zsh_completion.rb,
lib/doing/completion/completion_string.rb

Overview

Template coloring

Direct Known Subclasses

Doing::TemplateString

Constant Summary

Constants included from Doing::Color

Doing::Color::ATTRIBUTES, Doing::Color::ATTRIBUTE_NAMES, Doing::Color::COLORED_REGEXP

Instance Method Summary collapse

Methods included from Doing::Completion::StringUtils

#ltrunc, #ltrunc!, #short_desc

Methods included from Doing::ChronifyString

#chronify, #chronify_qty, #expand_date_tags, #is_range?, #split_date_range, #time_string, #to_seconds

Methods included from Doing::StringURL

#clean_unlinked_urls, #link_urls, #link_urls!, #remove_self_links, #replace_qualified_urls

Methods included from Doing::StringTruncate

#trunc, #trunc!, #truncend, #truncend!, #truncmiddle, #truncmiddle!

Methods included from Doing::StringTransform

#cap_first, #compress, #compress!, #set_type, #simple_wrap, #titlecase, #to_p, #wrap

Methods included from Doing::StringTags

#add_at, #add_tags, #add_tags!, #dedup_tags, #dedup_tags!, #remove_at, #split_tags, #tag, #tag!, #to_tags

Methods included from Doing::StringQuery

#ignore?, #ignore_case, #rx?, #to_bool, #to_phrase_query, #to_query, #to_rx, #truthy?, #wildcard_to_rx

Methods included from Doing::StringHighlight

#highlight_search, #highlight_search!, #highlight_tags, #highlight_tags!, #last_color, #uncolor, #uncolor!

Methods included from Doing::Color

#attributes, coloring?, #rgb, #support?, template, #uncolor

Methods included from Doing::StringNormalize

#normalize_age, #normalize_age!, #normalize_bool, #normalize_bool!, #normalize_case, #normalize_case!, #normalize_change_type, #normalize_matching, #normalize_matching!, #normalize_order, #normalize_order!, #normalize_tag_sort, #normalize_tag_sort!, #normalize_trigger, #normalize_trigger!

Instance Method Details

#good?Boolean

Tests if object is nil or empty

Returns:

  • (Boolean)

    true if object is defined and has content

#normalize_colorString

Normalize a color name, removing underscores, replacing "bright" with "bold", and converting bgbold to boldbg

Returns:

  • (String)

    Normalized color name

#sanitizeObject

#utf8String

Force UTF-8 encoding if available

Returns:

  • (String)

    UTF-8 encoded string

#valid_id?Boolean

Test if string is a valid 32-character MD5 id

Returns:

  • (Boolean)

    string is valid identifier

#validate_colorString

Extract the longest valid %color name from a string.

Allows %colors to bleed into other text and still be recognized, e.g. %greensomething still finds %green.

Returns:

  • (String)

    a valid color name