日時をよしなに解釈する。
2014 年 3 月 5 日
Comments off
Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs.
とあるRailsアプリでcronを管理するためにwheneverを使い始めたのですが(便利ですね!これ)、時間指定のところで「4:30 am」や「12pm」、「12:20am」など、いろいろな記法を受け入れていて、どんな実装になっているんだろうとソースを見たらchronicというgemを使っていました。
https://github.com/javan/whenever/blob/master/lib/whenever/cron.rb#L15
Chronic is a natural language date/time parser written in pure Ruby. See below for the wide variety of formats Chronic will parse.
こちらも便利で、ありがたい。