Class: Jira::Auto::Tool::Sprint::Prefix

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/jira/auto/tool/sprint/prefix.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, sprints = []) ⇒ Prefix



14
15
16
17
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 14

def initialize(name, sprints = [])
  @name = name
  @sprints = sprints
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 12

def name
  @name
end

Class Method Details

.to_table_row_header(without_board_information: false) ⇒ Object



47
48
49
50
51
52
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 47

def self.to_table_row_header(without_board_information: false)
  sprint_header = Sprint.to_table_row_header(without_board_information: without_board_information)
  0.upto(1) { |i| sprint_header[i] = "Last Sprint #{sprint_header[i]}" }

  ["Sprint Prefix"].concat(sprint_header)
end

Instance Method Details

#<<(sprint) ⇒ Object



23
24
25
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 23

def <<(sprint)
  @sprints << sprint
end

#<=>(other) ⇒ Object



59
60
61
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 59

def <=>(other)
  [name, sprints] <=> [other.name, other.sprints]
end

#add_sprint_following_last_oneObject



35
36
37
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 35

def add_sprint_following_last_one
  self << NextSprintCreator.create_sprint_following(last_sprint)
end

#covered?(until_date) ⇒ Boolean



31
32
33
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 31

def covered?(until_date)
  last_sprint.end_date > until_date.time
end

#last_sprintObject



54
55
56
57
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 54

def last_sprint
  log.debug { "name = #{name}, #sprints = #{sprints.size}" }
  sprints.max
end

#quarterly_add_sprints_until(until_date) ⇒ Object



27
28
29
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 27

def quarterly_add_sprints_until(until_date)
  add_sprint_following_last_one until covered?(until_date)
end

#sprintsObject



19
20
21
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 19

def sprints
  @sprints.sort
end

#to_sObject



39
40
41
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 39

def to_s
  "name: #{name}, sprints: #{sprints}"
end

#to_table_row(without_board_information: false) ⇒ Object



43
44
45
# File 'lib/jira/auto/tool/sprint/prefix.rb', line 43

def to_table_row(without_board_information: false)
  [name].concat(last_sprint.to_table_row(without_board_information:))
end