File: jmonth.rb

package info (click to toggle)
tdiary-contrib 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,772 kB
  • sloc: ruby: 17,305; javascript: 8,263; lisp: 562; xml: 451; php: 61; sql: 40; makefile: 18
file content (20 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# jmonth.rb $Revision: 1.1 $
#
#「%i」で日本語の陰暦月名を出す
#    pluginに入れるだけで動作する。
#    日付フォーマットなどで「%i」を指定するとそこが陰暦月名になる
#
# Copyright (c) 2005 sasasin/SuzukiShinnosuke<sasasin@sasasin.sytes.net>
# You can distribute this file under the GPL.
#
unless Time::new.respond_to?( :strftime_jmonth_backup ) then
	eval( <<-MODIFY_CLASS, TOPLEVEL_BINDING )
		class Time
		   alias strftime_jmonth_backup strftime
		   JMONTH = %w(睦月 如月 弥生 卯月 皐月 水無月 文月 葉月 長月 神無月 霜月 師走)
		   def strftime( format )
		      strftime_jmonth_backup( format.gsub( /%i/, JMONTH[self.month-1] ) )
		   end
		end
	MODIFY_CLASS
end