class TrelloLeadTime::Card
Public Class Methods
from_trello_card(trello_card)
click to toggle source
# File lib/trello_lead_time/card.rb, line 3 def self.from_trello_card(trello_card) Card.new(trello_card) end
new(trello_card)
click to toggle source
# File lib/trello_lead_time/card.rb, line 7 def initialize(trello_card) @trello_card = trello_card @timeline = Timeline.for_trello_card(trello_card) end
Public Instance Methods
age_in_seconds()
click to toggle source
# File lib/trello_lead_time/card.rb, line 28 def age_in_seconds @timeline.age_in_seconds end
closed?()
click to toggle source
# File lib/trello_lead_time/card.rb, line 24 def closed? @trello_card.closed end
cycle_time()
click to toggle source
# File lib/trello_lead_time/card.rb, line 40 def cycle_time @_cycle_time ||= sum_of_times_in_lists(Config.cycle_time_lists) end
done?()
click to toggle source
# File lib/trello_lead_time/card.rb, line 20 def done? @timeline.done? end
has_label_color?(color)
click to toggle source
# File lib/trello_lead_time/card.rb, line 49 def has_label_color?(color) match = labels.find { |l| l.color =~ /^#{Regexp.quote(color)}$/i } !match.nil? end
has_label_name?(name)
click to toggle source
# File lib/trello_lead_time/card.rb, line 44 def has_label_name?(name) match = labels.find { |l| l.name =~ /^#{Regexp.quote(name)}$/i } !match.nil? end
labels()
click to toggle source
# File lib/trello_lead_time/card.rb, line 63 def labels @_labels ||= @trello_card.labels.map { |label| OpenStruct.new({name: label.name, color: label.color}) } end
lead_time()
click to toggle source
# File lib/trello_lead_time/card.rb, line 32 def lead_time @_lead_time ||= queue_time + cycle_time end
name()
click to toggle source
# File lib/trello_lead_time/card.rb, line 12 def name @trello_card.name end
queue_time()
click to toggle source
# File lib/trello_lead_time/card.rb, line 36 def queue_time @_queue_time ||= sum_of_times_in_lists(Config.queue_time_lists) end
short_url()
click to toggle source
# File lib/trello_lead_time/card.rb, line 16 def short_url @trello_card.short_url end
Private Instance Methods
comments()
click to toggle source
# File lib/trello_lead_time/card.rb, line 73 def comments @_comments ||= @trello_card.actions(filter:"commentCard").map { |comment| comment.data['text'] } end
sum_of_times_in_lists(lists)
click to toggle source
# File lib/trello_lead_time/card.rb, line 69 def sum_of_times_in_lists(lists) lists.inject(0) { |sum, list_name| sum + @timeline.seconds_in_list(list_name) } end