Sha256: bba092c0c175dd2001b3152cc13b892023048d28a297538d38cd84cb100890ec
Contents?: true
Size: 602 Bytes
Versions: 2
Compression:
Stored size: 602 Bytes
Contents
module Tw::App class Render def self.color_code(str) colors = Sickill::Rainbow::TERM_COLORS.keys - [:default, :black, :white] n = str.each_byte.map{|c| c.to_i}.inject{|a,b|a+b} return colors[n%colors.size] end def self.display(arr) arr.flatten.sort{|a,b| a[:id] <=> b[:id] }.uniq.each{|m| user = m[:user].kind_of?(Hash) ? "@#{m[:user][:from]} > @#{m[:user][:to]}" : "@#{m[:user]}" line = "#{m[:time].strftime '[%m/%d %a] (%H:%M:%S)'} #{user} : #{m[:text]}" puts line.colorize(/@[a-zA-Z0-9_]+/) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tw-0.1.1 | lib/tw/app/render.rb |
tw-0.1.0 | lib/tw/app/render.rb |