Sha256: 58e947a147316dde0ae6fa546d18505cc5dc4f491b46b8a37e216d90d1f9893a
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require "drexed/datetime/version" module Drexed module Datetime class Engine < ::Rails::Engine ## Time.datetime_to("yyyy-mm-dd") => "2012-03-04" def datetime_to(tach) delineators = tach.scan /\W+/ formatters = tach.scan /[a-z]+/i units = { "yy" => "y", "yyyy" => "Y", "m" => "-m", "mm" => "m", "M" => "b", "MM" => "B", "d" => "-d", "dd" => "d", "D" => "a", "DD" => "A", "h" => "-I", "hh" => "I", "H" => "-H", "HH" => "H", "mi" => "M", "p" => "P", "P" => "p" } strftime(formatters.map{ |f| "%#{units[f]}#{delineators.shift || ""}" }.join) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
drexed-datetime-0.0.7 | lib/drexed/datetime.rb |