class Kanboard::Card

Kanban card

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

the card embeds information such as:

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

Constants

GENERIC_SWIMLANE
NO_ONE

Attributes

project[RW]
status[RW]

Public Class Methods

new(project, status, title) click to toggle source
# 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

Public Instance Methods

created() click to toggle source
# File lib/kanboard/card.rb, line 45
def created
  find("c:", @title)
end
done?() click to toggle source
# File lib/kanboard/card.rb, line 53
def done?
  finished != nil
end
due() click to toggle source
# File lib/kanboard/card.rb, line 57
def due
  find("d:", @title)
end
finished() click to toggle source
# File lib/kanboard/card.rb, line 49
def finished
  find("f:", @title)
end
owner() click to toggle source
# File lib/kanboard/card.rb, line 37
def owner
  find("@", @title) || NO_ONE
end
swimlane() click to toggle source
# File lib/kanboard/card.rb, line 41
def swimlane
  find("\\+", @title) || GENERIC_SWIMLANE
end
to_s() click to toggle source
# File lib/kanboard/card.rb, line 61
def to_s
  @title
end

Private Instance Methods

find(tag, string) click to toggle source

find a substring of the type tag+ in argument return nil if not found.

# File lib/kanboard/card.rb, line 69
def find(tag, string)
  match = string.match(Regexp.new(tag + "([\\w]+)"))
  match ? match[1] : nil
end