class Sidekiq::Statistic::Helpers::Color
Public Class Methods
for(worker_name, format = :rgb)
click to toggle source
# File lib/sidekiq/statistic/helpers/color.rb, line 8 def for(worker_name, format = :rgb) rgb = Digest::MD5.hexdigest(worker_name)[0..5] .scan(/../) .map { |color| color.to_i(16) } .join(',') return to_hex(rgb) if format == :hex rgb end
Private Class Methods
to_hex(rgb)
click to toggle source
# File lib/sidekiq/statistic/helpers/color.rb, line 21 def to_hex(rgb) '#' + rgb.split(',').map { |v| v.to_i.to_s(16).rjust(2, '0').upcase }.join end