Class: Jirack::Sprint
- Inherits:
-
Object
- Object
- Jirack::Sprint
- Defined in:
- lib/jirack/sprint.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#name ⇒ Object
Returns the value of attribute name.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#state ⇒ Object
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
- #active? ⇒ Boolean
- #future? ⇒ Boolean
-
#initialize(field_string) ⇒ Sprint
constructor
A new instance of Sprint.
- #number ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(field_string) ⇒ Sprint
Returns a new instance of Sprint.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jirack/sprint.rb', line 10 def initialize(field_string) sprint_array = field_string[0].split(',') @name = sprint_array[3].split('=')[1] @state = sprint_array[2].split('=')[1] start_date_string = sprint_array[5].split('=')[1] if start_date_string != '<null>' @start_date = DateTime.parse(start_date_string) end end_date_string = sprint_array[6].split('=')[1] if end_date_string != '<null>' @start_date = DateTime.parse(end_date_string) end end |
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
8 9 10 |
# File 'lib/jirack/sprint.rb', line 8 def end_date @end_date end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/jirack/sprint.rb', line 8 def name @name end |
#start_date ⇒ Object
Returns the value of attribute start_date.
8 9 10 |
# File 'lib/jirack/sprint.rb', line 8 def start_date @start_date end |
#state ⇒ Object
Returns the value of attribute state.
8 9 10 |
# File 'lib/jirack/sprint.rb', line 8 def state @state end |
Class Method Details
.active_sprint(client) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/jirack/sprint.rb', line 39 def self.active_sprint(client) cred = Jirack::Credential.new JIRA::Resource::Issue.jql(client, "project=\"#{ cred.project_name }\" AND assignee = currentuser()").find do |issue| issue.sprint.active? end.sprint end |
Instance Method Details
#active? ⇒ Boolean
31 32 33 |
# File 'lib/jirack/sprint.rb', line 31 def active? @state == 'ACTIVE' end |
#future? ⇒ Boolean
35 36 37 |
# File 'lib/jirack/sprint.rb', line 35 def future? @state == 'FUTURE' end |
#number ⇒ Object
27 28 29 |
# File 'lib/jirack/sprint.rb', line 27 def number @name.split(' ')[1].to_i end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/jirack/sprint.rb', line 47 def to_s "Jirack::Sprint name: #{ @name }, state: #{ @state }, start_date: #{ @start_date }, end_date: #{ @end_date }" end |