root/platform/tdiary/plugin/jmonth.rb

Revision 5057, 0.7 kB (checked in by hsbt, 11 months ago)

platform/tdiary/plugin: changed file encoding to UTF-8

Line 
1# jmonth.rb $Revision: 1.1 $
2#
3#「%i」で日本語の陰暦月名を出す
4#    pluginに入れるだけで動作する。
5#    日付フォーマットなどで「%i」を指定するとそこが陰暦月名になる
6#
7# Copyright (c) 2005 sasasin/SuzukiShinnosuke<sasasin@sasasin.sytes.net>
8# You can distribute this file under the GPL.
9#
10unless Time::new.respond_to?( :strftime_jmonth_backup ) then
11        eval( <<-MODIFY_CLASS, TOPLEVEL_BINDING )
12                class Time
13                   alias strftime_jmonth_backup strftime
14                   JMONTH = %w(睦月 如月 弥生 卯月 皐月 水無月 文月 葉月 長月 神無月 霜月 師走)
15                   def strftime( format )
16                      strftime_jmonth_backup( format.gsub( /%i/, JMONTH[self.month-1] ) )
17                   end
18                end
19        MODIFY_CLASS
20end
Note: See TracBrowser for help on using the browser.