Class: Kanboard::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/kanboard/card.rb

Overview

Kanban card

Textile markupped text describing a card. a card is a line of text starting with a dash “-”

  • @adolfo fix this #bug: 234 (c:2013-02-15)

the card embeds information such as:

  • owner: @name

  • swimlane: +swimlane (at most one)

  • tags: #tag1, #tag2 (TODO)

  • creation date: c:

  • finish date: f:

  • due date: d:

the card stores also information which is defined elsewhere in the kanban file. This information includes:

  • project: the project the card refers to (set with a h1. tag in the file)

  • status: the current status of the card (set with a h2. tag in the file)

Constant Summary collapse

GENERIC_SWIMLANE =

the swimlane for cards with no swimlane

"Generic"
NO_ONE =

the owned of cards not owned by anyone

"Unassigned"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, status, title) ⇒ Card

Returns a new instance of Card.



31
32
33
34
35
# File 'lib/kanboard/card.rb', line 31

def initialize(project, status, title)
  @project = project
  @status = status
  @title = title[2, title.length] # forget about the initial "- "
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



29
30
31
# File 'lib/kanboard/card.rb', line 29

def project
  @project
end

#statusObject

Returns the value of attribute status.



29
30
31
# File 'lib/kanboard/card.rb', line 29

def status
  @status
end

Instance Method Details

#createdObject



45
46
47
# File 'lib/kanboard/card.rb', line 45

def created
  find("c:", @title)
end

#done?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/kanboard/card.rb', line 53

def done?
  finished != nil
end

#dueObject



57
58
59
# File 'lib/kanboard/card.rb', line 57

def due
  find("d:", @title)
end

#finishedObject



49
50
51
# File 'lib/kanboard/card.rb', line 49

def finished
  find("f:", @title)
end

#ownerObject



37
38
39
# File 'lib/kanboard/card.rb', line 37

def owner
  find("@", @title) || NO_ONE
end

#swimlaneObject



41
42
43
# File 'lib/kanboard/card.rb', line 41

def swimlane
  find("\\+", @title) || GENERIC_SWIMLANE
end

#to_sObject



61
62
63
# File 'lib/kanboard/card.rb', line 61

def to_s
  @title
end