class Jirify::Models::Status
Protected Class Methods
all()
click to toggle source
# File lib/jirify/models/status.rb, line 32 def all client.Status.all.map { |status| Status.new status } end
status_order()
click to toggle source
# 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
Public Instance Methods
<=>(other)
click to toggle source
# 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()
click to toggle source
# 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
Protected Instance Methods
longest_status_name()
click to toggle source
# File lib/jirify/models/status.rb, line 27 def longest_status_name Config.statuses.values.map(&:length).max end