Class: Doing::Note

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

Overview

This class describes an item note.

Instance Method Summary collapse

Methods inherited from Array

#highlight_tags, #log_tags, #nested_hash, #to_tags, #to_tags!

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 or array (Note)

  • replace (Boolean) (defaults to: false)

    replace existing content

#append(lines) ⇒ Object

Append an array of strings to note

Parameters:

  • lines (Array)

    Array of strings

#append_string(input) ⇒ Object

Append a string to the note content

Parameters:

  • input (String)

    The input string, newlines will be split

#compressArray

Remove blank lines and comment lines (#)

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