class TPS::Sprint

Attributes

id[RW]
list[RW]
name[RW]

Public Class Methods

new(id, name, list) click to toggle source
# File lib/tps/sprint.rb, line 7
def initialize(id, name, list)
  @id = id
  @name = name
  @list = list
end

Public Instance Methods

index() click to toggle source

Returns the numeric index of the sprint.

s1.index  #=> 0
s2.index  #=> 1
# File lib/tps/sprint.rb, line 18
def index
  list.sprints.keys.index id
end
inspect() click to toggle source
# File lib/tps/sprint.rb, line 42
def inspect
  '#<%s %s ("%s")>' % [ self.class.name, id, name ]
end
percent() click to toggle source
# File lib/tps/sprint.rb, line 30
def percent
  sublist ? sublist.percent : 0.0
end
points() click to toggle source
# File lib/tps/sprint.rb, line 22
def points
  sublist ? sublist.points_for(self) : 0.0
end
points_done() click to toggle source
# File lib/tps/sprint.rb, line 26
def points_done
  sublist ? sublist.points_done : 0.0
end
slug() click to toggle source
# File lib/tps/sprint.rb, line 38
def slug
  slugify id
end
sublist() click to toggle source
# File lib/tps/sprint.rb, line 34
def sublist
  @sublist ||= list.filter_by_sprint(self)
end
to_s() click to toggle source
# File lib/tps/sprint.rb, line 46
def to_s
  inspect
end

Private Instance Methods

slugify(str) click to toggle source
# File lib/tps/sprint.rb, line 52
def slugify(str)
  str.scan(/[A-Za-z0-9]+/).join('_').downcase
end