Sha256: d356b1322d0d640cba47aea7ee5584eaea0418dce8fe5b44d925d4407344d0c0
Contents?: true
Size: 748 Bytes
Versions: 19
Compression:
Stored size: 748 Bytes
Contents
require 'parsedate' module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module String #:nodoc: # Converting strings to other objects module Conversions # 'a'.ord == 'a'[0] for Ruby 1.9 forward compatibility. def ord self[0] end if RUBY_VERSION < '1.9' # Form can be either :utc (default) or :local. def to_time(form = :utc) ::Time.send("#{form}_time", *ParseDate.parsedate(self)[0..5].map {|arg| arg || 0}) end def to_date ::Date.new(*ParseDate.parsedate(self)[0..2]) end def to_datetime ::DateTime.civil(*ParseDate.parsedate(self)[0..5].map {|arg| arg || 0} << 0) end end end end end
Version data entries
19 entries across 19 versions & 4 rubygems