diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-24 05:55:54 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-24 05:55:54 +0000 |
| commit | 87b770c8e3a257b6255e1f3dc0c488ed88863c53 (patch) | |
| tree | db8bd70ac0b943660636ca0cbfe2c21b9708f2b8 | |
| parent | a834d7fe61fa307e47984022184195652799fc32 (diff) | |
merge revision(s) 35453:
* lib/optparse.rb (OptionParser#to_a): String#to_a is no longer
defined. [ruby-dev:45568][Bug #6348]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/optparse.rb | 4 | ||||
| -rw-r--r-- | test/optparse/test_summary.rb | 17 | ||||
| -rw-r--r-- | version.h | 6 |
4 files changed, 27 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Tue Apr 24 14:55:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/optparse.rb (OptionParser#to_a): String#to_a is no longer + defined. [ruby-dev:45568][Bug #6348] + Sat Apr 21 07:16:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * strftime.c (rb_strftime_with_timespec): fix padding of time zone diff --git a/lib/optparse.rb b/lib/optparse.rb index a448459d46..75c6b76bc6 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1065,13 +1065,13 @@ XXX # # Returns option summary string. # - def help; summarize(banner.to_s.sub(/\n?\z/, "\n")) end + def help; summarize("#{banner}".sub(/\n?\z/, "\n")) end alias to_s help # # Returns option summary list. # - def to_a; summarize(banner.to_a.dup) end + def to_a; summarize([*banner]) end # # Checks if an argument is given twice, in which case an ArgumentError is diff --git a/test/optparse/test_summary.rb b/test/optparse/test_summary.rb index 0c67d7f0f9..bda3b49890 100644 --- a/test/optparse/test_summary.rb +++ b/test/optparse/test_summary.rb @@ -18,4 +18,21 @@ class TestOptionParser::SummaryTest < TestOptionParser assert_match(/description 2/, s[1]) assert_match(/last-option/, s[-1]) end + + def test_banner + o = OptionParser.new("foo bar") + assert_equal("foo bar", o.banner) + end + + def test_banner_from_progname + o = OptionParser.new + o.program_name = "foobar" + assert_equal("Usage: foobar [options]\n", o.help) + end + + def test_summary + o = OptionParser.new("foo bar") + assert_equal("foo bar\n", o.to_s) + assert_equal(["foo bar"], o.to_a) + end end @@ -1,10 +1,10 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 196 +#define RUBY_PATCHLEVEL 197 -#define RUBY_RELEASE_DATE "2012-04-21" +#define RUBY_RELEASE_DATE "2012-04-24" #define RUBY_RELEASE_YEAR 2012 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 21 +#define RUBY_RELEASE_DAY 24 #include "ruby/version.h" |
