Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/doing/array.rb,
lib/doing/array_chronify.rb

Overview

Chronify array helpers

Direct Known Subclasses

Doing::Items, Doing::Note

Instance Method Summary collapse

Instance Method Details

#highlight_tags(color = 'cyan') ⇒ String

Hightlight @tags in string for console output

Parameters:

  • color (String) (defaults to: 'cyan')

    the color to highlight with

Returns:

  • (String)

    string with @tags highlighted

#log_tagsString

Tag array for logging

Returns:

  • (String)

    Highlighted tag array joined with comma

#nested_hash(value) ⇒ Object

Convert array to nested hash, setting last key to value

Parameters:

  • value

    The value to set

Raises:

  • (StandardError)

#tags_to_arrayArray

Convert an @tags to plain strings

Returns:

  • (Array)

    array of strings

#time_string(format: :dhm) ⇒ String

Format [d, h, m] as string

Parameters:

  • time (Array)

    Array of [days, hours, minutes]

  • format (Symbol) (defaults to: :dhm)

    The format, :dhm, :hm, :m, :clock, :natural

Returns:

  • (String)

    formatted string

Raises:

  • (InvalidArgument)

#to_tagsArray

Convert strings to @tags

Examples:

['one', '@two', 'three'].to_tags

=> ['@one', '@two', '@three']

Returns:

  • (Array)

    Array of @tags

#to_tags!Object