diff options
-rw-r--r-- | lib/slop.rb | 6 | ||||
-rw-r--r-- | test/slop_test.rb | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/slop.rb b/lib/slop.rb index 143c296..026f64b 100644 --- a/lib/slop.rb +++ b/lib/slop.rb @@ -332,7 +332,11 @@ class Slop # # text - The String text to print. def separator(text) - @separators[options.size] = text + if @separators[options.size] + @separators[options.size] << "\n#{text}" + else + @separators[options.size] = text + end end # Print a handy Slop help string. diff --git a/test/slop_test.rb b/test/slop_test.rb index bd00444..4195528 100644 --- a/test/slop_test.rb +++ b/test/slop_test.rb @@ -291,9 +291,10 @@ class SlopTest < TestCase opts = Slop.new do on :foo separator "hello" + separator "world" on :bar end - assert_equal " --foo \nhello\n --bar ", opts.help + assert_equal " --foo \nhello\nworld\n --bar ", opts.help end test "printing help with :help => true" do |