diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-21 04:27:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-21 04:27:06 +0000 |
commit | 564c80b10a116c49ac0dbcfe620e3f776c0d3845 (patch) | |
tree | 72d6bfaf40ae3ad0043c88122796d134720aba54 /lib/optparse/date.rb | |
parent | bec6d3b1b9a5fcc4ed37c98814e114066cfcc0a5 (diff) | |
download | ruby-564c80b10a116c49ac0dbcfe620e3f776c0d3845.tar.gz |
* lib/optparse.rb: get rid of warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/optparse/date.rb')
-rw-r--r-- | lib/optparse/date.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/optparse/date.rb b/lib/optparse/date.rb new file mode 100644 index 0000000000..c9f072f290 --- /dev/null +++ b/lib/optparse/date.rb @@ -0,0 +1,17 @@ +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 + DateTime.parse(s) if s + rescue ArgumentError + raise OptionParser::InvalidArgument, s + end +end |