[ruby-list:49452] [ANN] when_exe 0.3.1
From:
"Takashi SUGA" <suchowan@...>
Date:
2013-06-06 00:29:08 UTC
List:
ruby-list #49452
おひさしぶりです。須賀です。
when_exe 0.3.1 をリリースしました。
https://rubygems.org/gems/when_exe
まだ評価途中のβ版です。
when_exe は時間スキーマを総合的に扱うライブラリで、主に
ISO19108, ISO8601, RFC 5545 などを参照しています。詳しくは
http://www2u.biglobe.ne.jp/~suchowan/when_exe_wiki.html
をごらんください。
# 英語でドキュメントを書く余裕がありませんでした ^^;
ひとつだけ例を挙げるとこんな感じです。
明治改暦前後の七曜表を3か月分計算する
----
require 'when_exe'
include When
date = TemporalPosition('Meiji', 5, 12) #=> 明治05(1872).12.
date.month_included('Sun', -1..1) { |d, t| #=> 下記
case t
when MONTH ; d.strftime("%B %Y") / 'en'
when WEEK ; nil
when DAY ; d[DAY]
else ; '-'
end
}
----
[["11th Month 5",
[1, 2, 3, 4, 5, 6, 7],
[8, 9, 10, 11, 12, 13, 14],
[15, 16, 17, 18, 19, 20, 21],
[22, 23, 24, 25, 26, 27, 28],
[29, "-", "-", "-", "-", "-", "-"]],
["12th Month 5",
["-", 1, 2, "-", "-", "-", "-"]],
["January 6",
["-", "-", "-", 1, 2, 3, 4],
[5, 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17, 18],
[19, 20, 21, 22, 23, 24, 25],
[26, 27, 28, 29, 30, 31, "-"]]]
--------
須賀隆
Blog: http://suchowan.at.webry.info/