Class: Pickler::Tracker::Iteration

Inherits:
Abstract
  • Object
show all
Defined in:
lib/pickler/tracker/iteration.rb

Instance Attribute Summary collapse

Attributes inherited from Abstract

#attributes

Instance Method Summary collapse

Methods inherited from Abstract

accessor, date_reader, #id, reader, #to_xml

Constructor Details

#initialize(project, attributes = {}) ⇒ Iteration

Returns a new instance of Iteration.



6
7
8
9
# File 'lib/pickler/tracker/iteration.rb', line 6

def initialize(project, attributes = {})
  @project = project
  super(attributes)
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



4
5
6
# File 'lib/pickler/tracker/iteration.rb', line 4

def project
  @project
end

Instance Method Details

#finishObject



15
16
17
# File 'lib/pickler/tracker/iteration.rb', line 15

def finish
  Date.parse(attributes['finish'].to_s)
end

#include?(date) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/pickler/tracker/iteration.rb', line 28

def include?(date)
  range.include?(date)
end

#inspectObject



36
37
38
# File 'lib/pickler/tracker/iteration.rb', line 36

def inspect
  "#<#{self.class.inspect}:#{number.inspect} (#{range.inspect})>"
end

#numberObject Also known as: to_i



19
20
21
# File 'lib/pickler/tracker/iteration.rb', line 19

def number
  attributes['number'].to_i
end

#rangeObject



24
25
26
# File 'lib/pickler/tracker/iteration.rb', line 24

def range
  start...finish
end

#startObject



11
12
13
# File 'lib/pickler/tracker/iteration.rb', line 11

def start
  Date.parse(attributes['start'].to_s)
end

#succObject



32
33
34
# File 'lib/pickler/tracker/iteration.rb', line 32

def succ
  self.class.new(project, 'number' => number.succ.to_s, 'start' => attributes['finish'], 'finish' => (finish + (finish - start)))
end

#to_sObject



40
41
42
# File 'lib/pickler/tracker/iteration.rb', line 40

def to_s
  "#{number} (#{start}...#{finish})"
end