summaryrefslogtreecommitdiff
path: root/lib/optparse
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-21 04:27:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-21 04:27:06 +0000
commit564c80b10a116c49ac0dbcfe620e3f776c0d3845 (patch)
tree72d6bfaf40ae3ad0043c88122796d134720aba54 /lib/optparse
parentbec6d3b1b9a5fcc4ed37c98814e114066cfcc0a5 (diff)
downloadruby-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')
-rw-r--r--lib/optparse/date.rb17
-rw-r--r--lib/optparse/shellwords.rb2
-rw-r--r--lib/optparse/time.rb2
-rw-r--r--lib/optparse/uri.rb2
4 files changed, 20 insertions, 3 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
diff --git a/lib/optparse/shellwords.rb b/lib/optparse/shellwords.rb
index 75cb57b72b..0422d7c887 100644
--- a/lib/optparse/shellwords.rb
+++ b/lib/optparse/shellwords.rb
@@ -3,4 +3,4 @@
require 'shellwords'
require 'optparse'
-OptionParser.accept(Shellwords) {|s| Shellwords.shellwords(s)}
+OptionParser.accept(Shellwords) {|s,| Shellwords.shellwords(s)}
diff --git a/lib/optparse/time.rb b/lib/optparse/time.rb
index 9f677a8d31..402cadcf16 100644
--- a/lib/optparse/time.rb
+++ b/lib/optparse/time.rb
@@ -1,7 +1,7 @@
require 'optparse'
require 'time'
-OptionParser.accept(Time) do |s|
+OptionParser.accept(Time) do |s,|
begin
(Time.httpdate(s) rescue Time.parse(s)) if s
rescue
diff --git a/lib/optparse/uri.rb b/lib/optparse/uri.rb
index 5bdcf57c96..024dc69eac 100644
--- a/lib/optparse/uri.rb
+++ b/lib/optparse/uri.rb
@@ -3,4 +3,4 @@
require 'optparse'
require 'uri'
-OptionParser.accept(URI) {|s| URI.parse(s) if s}
+OptionParser.accept(URI) {|s,| URI.parse(s) if s}