lib/ayadn/workers.rb in ayadn-2.0.6 vs lib/ayadn/workers.rb in ayadn-2.0.7

- old
+ new

@@ -36,11 +36,11 @@ table.title = "Your blacklist".color(:cyan) + "".color(:white) table.style = table_borders() table.headings = [ 'Name', 'Type' ] list.sort! list.each_with_index do |obj, index| - table << ["#{obj[1].capitalize}".color(:green), "#{obj[0]}".color(:red)] + table << ["#{obj[1].capitalize}".to_s.force_encoding("UTF-8").color(:green), "#{obj[0]}".to_s.force_encoding("UTF-8").color(:red)] if index + 1 != list.length && Settings.options[:timeline][:compact] == false table << :separator end end table @@ -49,11 +49,11 @@ def build_reposted_list(list, target) table = init_table table.title = "List of users who reposted post ".color(:cyan) + "#{target}".color(:red) + "".color(:white) users_list = [] list.each do |obj| - obj['name'].nil? ? name = "" : name = obj['name'] + obj['name'].nil? ? name = "" : name = obj['name'].to_s.force_encoding("UTF-8") users_list << {:username => obj['username'], :name => name, :you_follow => obj['you_follow'], :follows_you => obj['follows_you'], :id => obj['id'], :posts => obj['counts']['posts']} end table.style = table_borders() return users_list, table end @@ -61,11 +61,11 @@ def build_starred_list(list, target) table = init_table table.title = "List of users who starred post ".color(:cyan) + "#{target}".color(:red) + "".color(:white) users_list = [] list.each do |obj| - obj['name'].nil? ? name = "" : name = obj['name'] + obj['name'].nil? ? name = "" : name = obj['name'].to_s.force_encoding("UTF-8") users_list << {:username => obj['username'], :name => name, :you_follow => obj['you_follow'], :follows_you => obj['follows_you'], :id => obj['id'], :posts => obj['counts']['posts']} end table.style = table_borders() return users_list, table end @@ -142,10 +142,10 @@ else posts_day = 'unknown' end obj[:username].length > 23 ? username = "#{obj[:username][0..20]}..." : username = obj[:username] obj[:name].length > 23 ? name = "#{obj[:name][0..20]}..." : name = obj[:name] - arr << [ "@#{username} ".color(Settings.options[:colors][:username]), "#{name}", obj[:posts], posts_day ] + arr << [ "@#{username} ".color(Settings.options[:colors][:username]), "#{name.to_s.force_encoding('UTF-8')}", obj[:posts], posts_day ] end if options[:posts_day] arr.sort_by! { |obj| obj[3].to_f } end if options[:reverse]