Sha256: 70002b25a4b22c00049c9aacec3f882dcb3d29bddaea832ac614af716407ac63

Contents?: true

Size: 925 Bytes

Versions: 38

Compression:

Stored size: 925 Bytes

Contents

# 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 or any later version.
#
#
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

38 entries across 28 versions & 1 rubygems

Version Path
tdiary-5.3.0 misc/plugin/comment_rank.rb
tdiary-5.2.4 misc/plugin/comment_rank.rb
tdiary-5.2.3 misc/plugin/comment_rank.rb
tdiary-5.2.2 misc/plugin/comment_rank.rb
tdiary-5.2.1 misc/plugin/comment_rank.rb
tdiary-5.2.0 misc/plugin/comment_rank.rb
tdiary-5.1.7 misc/plugin/comment_rank.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/misc/plugin/comment_rank.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/comment_rank.rb
tdiary-5.1.6 misc/plugin/comment_rank.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/comment_rank.rb
tdiary-5.1.5 misc/plugin/comment_rank.rb
tdiary-5.1.4 misc/plugin/comment_rank.rb
tdiary-5.1.3 misc/plugin/comment_rank.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/comment_rank.rb
tdiary-5.1.2 misc/plugin/comment_rank.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/comment_rank.rb
tdiary-5.1.1 misc/plugin/comment_rank.rb
tdiary-5.1.0 misc/plugin/comment_rank.rb
tdiary-5.0.14 misc/plugin/comment_rank.rb