Sha256: 9e421ee5fbe7bb824778ee7928598dfa804b9120800ea74043486499c58a5f2f

Contents?: true

Size: 928 Bytes

Versions: 22

Compression:

Stored size: 928 Bytes

Contents

# -*- coding: utf-8 -*-
# comment_rank.rb
#
# comment_rank: ツッコミの数でランキング
#   パラメタ:
#     max:  最大表示数(未指定時:5)
#     sep:  セパレータ(未指定時:空白)
#     except:        無視する名前(いくつもある場合は,で区切って並べる)
#
# Copyright (c) 2002 TADA Tadashi <sho@spc.gr.jp>
# You can distribute this file under the GPL2.
#
#
def comment_rank( max = 5, sep = '&nbsp;', *except )
	name = Hash::new(0)
	@diaries.each_value do |diary|
		diary.each_comment do |comment|
			next if except.include?(comment.name)
			name[comment.name] += 1
		end
	end
	result = []
	name.sort{|a,b| (a[1])<=>(b[1])}.reverse.each_with_index do |ary,idx|
		break if idx >= max
		result << "<strong>#{idx+1}.</strong>#{h ary[0]}(#{ary[1].to_s})"
	end
	result.join( sep )
end


# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
tdiary-4.0.5.1 misc/plugin/comment_rank.rb
tdiary-4.0.5 misc/plugin/comment_rank.rb
tdiary-4.0.4 misc/plugin/comment_rank.rb
tdiary-4.0.3 misc/plugin/comment_rank.rb
tdiary-4.0.2.20140201 misc/plugin/comment_rank.rb
tdiary-4.0.2 misc/plugin/comment_rank.rb
tdiary-4.0.1.20131102 misc/plugin/comment_rank.rb
tdiary-4.0.1.20130929 misc/plugin/comment_rank.rb
tdiary-4.0.1.20130903 misc/plugin/comment_rank.rb
tdiary-4.0.1 misc/plugin/comment_rank.rb
tdiary-4.0.0.20130826 misc/plugin/comment_rank.rb
tdiary-4.0.0 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130727 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130722 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130720 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130617 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130614 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130604 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130527 misc/plugin/comment_rank.rb
tdiary-3.2.2.20130518 misc/plugin/comment_rank.rb