mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
73e4384a23
* lib/optparse.rb (OptionParser#help): new; OptionParser#to_s may be deprecated in future. * lib/optparse/version.rb (OptionParser#show_version): hide Object. * test/runner.rb: fix optparse usage. * test/runner.rb: glob all testsuits if no tests given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
17 lines
325 B
Ruby
17 lines
325 B
Ruby
require 'optparse'
|
|
require 'date'
|
|
|
|
OptionParser.accept(DateTime) do |s,|
|
|
begin
|
|
DateTime.parse(s) if s
|
|
rescue ArgumentError
|
|
raise OptionParser::InvalidArgument, s
|
|
end
|
|
end
|
|
OptionParser.accept(Date) do |s,|
|
|
begin
|
|
Date.parse(s) if s
|
|
rescue ArgumentError
|
|
raise OptionParser::InvalidArgument, s
|
|
end
|
|
end
|