Class: Task

Inherits:
Object
  • Object
show all
Defined in:
lib/todown/task.rb

Overview

Represent a task extracted from markdown file

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, finished = false, attributes = {}) ⇒ Task

Returns a new instance of Task

Parameters:

  • name (String)
  • finished (Boolean) (defaults to: false)
  • attributes (Hash) (defaults to: {})

    an hash containing various attributes



15
16
17
18
19
20
21
# File 'lib/todown/task.rb', line 15

def initialize(name, finished = false, attributes = {})
  @name = name
  @finished = finished
  @attributes = attributes

  parse_attributes!
end

Instance Attribute Details

#attributesHash (readonly)

Returns an hash containing various attributes.

Returns:

  • (Hash)

    an hash containing various attributes



8
9
10
# File 'lib/todown/task.rb', line 8

def attributes
  @attributes
end

#finishedBoolean (readonly)

Returns The status of the task (‘true` for completed, `false` for to do).

Returns:

  • (Boolean)

    The status of the task (‘true` for completed, `false` for to do)



6
7
8
# File 'lib/todown/task.rb', line 6

def finished
  @finished
end

#nameString (readonly)

Returns The name of the task.

Returns:

  • (String)

    The name of the task



4
5
6
# File 'lib/todown/task.rb', line 4

def name
  @name
end