Class: Doing::Note

Inherits:
Array show all
Defined in:
lib/doing/note.rb

Overview

This class describes an item note.

Instance Method Summary collapse

Methods inherited from Array

#good?

Constructor Details

#initialize(note = []) ⇒ Note

Initializes a new note

Parameters:

  • note (Array) (defaults to: [])

    Initial note, can be string or array

Instance Method Details

#add(note, replace: false) ⇒ Object

Add note contents, optionally replacing existing note

Parameters:

  • note (Array)

    The note to add, can be String, Array, or Note

  • replace (Boolean) (defaults to: false)

    replace existing content

#compressArray

Remove blank lines and comments (#)

Returns:

  • (Array)

    compressed array

#compress!Object

#equal?(other) ⇒ Boolean

Test if a note is equal (compare string representations)

Parameters:

  • other (Note)

    The other Note

Returns:

  • (Boolean)

    true if equal

#strip_linesArray

Remove leading/trailing whitespace for every line of note

Returns:

  • (Array)

    Stripped note

#strip_lines!Object

#to_sObject

Note as multi-line string