Class: String

Inherits:
Object show all
Defined in:
lib/doing/colors.rb,
lib/doing/good.rb,
lib/doing/normalize.rb

Overview

String to symbol conversion

Direct Known Subclasses

Doing::TemplateString

Instance Method Summary collapse

Instance Method Details

#good?Boolean

Tests if object is nil or empty

Returns:

  • (Boolean)

    true if object is defined and has content

#normalize_age(default = :newest) ⇒ Symbol

Convert an age string to a qualified type

Returns:

  • (Symbol)

    :oldest or :newest

#normalize_age!(default = :newest) ⇒ Object

See Also:

#normalize_bool(default = :and) ⇒ Object

Convert a boolean string to a symbol

Returns:

  • Symbol :and, :or, or :not

#normalize_bool!(default = :and) ⇒ Object

See Also:

#normalize_case(default = :smart) ⇒ Object

Convert a case sensitivity string to a symbol

Returns:

  • Symbol :smart, :sensitive, :ignore

#normalize_case!(default = :smart) ⇒ Object

See Also:

#normalize_colorString

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

Returns:

  • (String)

    Normalized color name

#normalize_matching(default = :pattern) ⇒ Object

Convert a matching configuration string to a symbol

Parameters:

  • default (Symbol) (defaults to: :pattern)

    the default matching type to return if the string doesn't match a known symbol

Returns:

  • Symbol :fuzzy, :pattern, :exact

#normalize_matching!(default = :pattern) ⇒ Object

#normalize_order(default = :asc) ⇒ Object

#normalize_order!(default = :asc) ⇒ Symbol

Convert a sort order string to a qualified type

Returns:

#normalize_tag_sort(default = :name) ⇒ Symbol

Convert tag sort string to a qualified type

Returns:

#normalize_tag_sort!(default = :name) ⇒ Object

#normalize_triggerString

Adds ?: to any parentheticals in a regular expression to avoid match groups

Returns:

  • (String)

    modified regular expression

#normalize_trigger!Object

See Also:

#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