1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/optparse.rb (SPLAT_PROC): fix for regexp. [ruby-dev:37514]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-12-21 03:23:19 +00:00
parent f6d905c022
commit 3e23c0c8c1
4 changed files with 20 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Sun Dec 21 12:23:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (SPLAT_PROC): fix for regexp. [ruby-dev:37514]
Fri Dec 19 20:42:35 2008 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
* lib/cgi/session.rb: ignore session_id options fixed.[Bug #605]

View file

@ -996,7 +996,7 @@ class OptionParser
end
private :notwice
SPLAT_PROC = proc {|*a| a}
SPLAT_PROC = proc {|*a| next *a}
#
# Creates an OptionParser::Switch from the parameters. The parsed argument
# value is passed to the given block, where it can be processed.

View file

@ -60,4 +60,16 @@ module TestOptionParser::ReqArg
assert_equal(%w"", no_error {@opt.parse!(%w"--opt=foo")})
assert_equal("foo", @flag)
end
class TestOptionParser::WithPattern < TestOptionParser
def test_pattern
pat = num = nil
@opt.def_option("--pattern=VAL", /(\w+)(?:\s*:\s*(\w+))?/) {|x, y, z| pat = [x, y, z]}
@opt.def_option("-T NUM", /\A[1-4]\z/) {|n| num = n}
no_error {@opt.parse!(%w"--pattern=key:val")}
assert_equal(%w"key:val key val", pat, '[ruby-list:45645]')
no_error {@opt.parse!(%w"-T 4")}
assert_equal("4", num, '[ruby-dev:37514]')
end
end
end

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.7"
#define RUBY_RELEASE_DATE "2008-12-19"
#define RUBY_RELEASE_DATE "2008-12-21"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20081219
#define RUBY_RELEASE_CODE 20081221
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 19
#define RUBY_RELEASE_DAY 21
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];