lib/tw/app/render.rb in tw-0.2.5 vs lib/tw/app/render.rb in tw-0.2.6
- old
+ new
@@ -7,12 +7,14 @@
return colors[n%colors.size]
end
def self.display(arr, format)
arr = [arr] unless arr.kind_of? Array
- arr.flatten.sort{|a,b|
+ arr.flatten.inject({}){
+ |h,i| h[i.id]=i; h
+ }.values.sort{|a,b|
a.id <=> b.id
- }.uniq.each{|m|
+ }.each{|m|
puts case format
when 'text'
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} : #{CGI.unescapeHTML m.text}"
line.colorize(/@[a-zA-Z0-9_]+/)