1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/parsedate.rb
matz 2f2cc0ddfc * error.c (errno_missing): Errno.const_missing to allow references
to SyscallError exceptions not defined on the platform.
  [ruby-core:04522]

* error.c (Init_syserr): Errno::NOERROR(0) for fallback exception.

* eval.c (block_pass): should not push unique number if a block is
  not an orphan.  [ruby-dev:25808]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-08 01:46:33 +00:00

21 lines
553 B
Ruby

# parsedate.rb: Written by Tadayoshi Funaba 2001, 2002
# $Id: parsedate.rb,v 2.6 2002-05-14 07:43:18+09 tadf Exp $
require 'date/format'
module ParseDate
def parsedate(str, comp=false)
Date._parse(str, comp).
values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
end
def strptime(str, format)
d = Date._strptime(str, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
d.values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
end
module_function :parsedate, :strptime
end