Class: Jirify::Models::Status
- Inherits:
-
Base
- Object
- Base
- Jirify::Models::Status
show all
- Defined in:
- lib/jirify/models/status.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
client, #initialize, #method_missing, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Jirify::Models::Base
Class Method Details
.all ⇒ Object
32
33
34
|
# File 'lib/jirify/models/status.rb', line 32
def all
client.Status.all.map { |status| Status.new status }
end
|
.status_order ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'lib/jirify/models/status.rb', line 36
def status_order
[
Config.statuses['blocked'],
Config.statuses['todo'],
Config.statuses['in_progress'],
Config.statuses['in_review'],
Config.statuses['done']
]
end
|
Instance Method Details
#<=>(other) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/jirify/models/status.rb', line 16
def <=>(other)
this_index = Status.status_order.index(name)
other_index = Status.status_order.index(other.name)
return 1 if other_index.nil?
return 0 if this_index.nil?
this_index - other_index
end
|
#pretty_name ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/jirify/models/status.rb', line 4
def pretty_name
justified = "(#{name})".rjust(longest_status_name + 2)
case name
when Config.statuses['blocked'] then justified.red
when Config.statuses['done'] then justified.green
when Config.statuses['in_progress'] then justified.blue
when Config.statuses['in_review'] then justified.yellow
when Config.statuses['todo'] then justified.black
else justified
end
end
|