slop 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/slop.rb +3 -3
  2. data/test/slop_test.rb +5 -0
  3. metadata +2 -2
@@ -16,7 +16,7 @@ class Slop
16
16
  class InvalidOptionError < RuntimeError; end
17
17
 
18
18
  # @return [String] The current version string
19
- VERSION = '1.5.4'
19
+ VERSION = '1.5.5'
20
20
 
21
21
  # Parses the items from a CLI format into a friendly object.
22
22
  #
@@ -307,8 +307,8 @@ class Slop
307
307
 
308
308
  items.each_with_index do |item, index|
309
309
  item = item.to_s
310
- flag = item.sub(/^--?/, '')
311
- option = @options[flag]
310
+ flag = item.sub(/\A--?/, '')
311
+ option = @options[flag] if item[/\A-/]
312
312
 
313
313
  unless option
314
314
  case item
@@ -99,6 +99,11 @@ class SlopTest < TestCase
99
99
  assert_equal %w/foo bar baz/, items
100
100
  end
101
101
 
102
+ test 'only parsing options' do
103
+ slop = Slop.new { on :n, true }
104
+ assert slop.parse %w/n/
105
+ end
106
+
102
107
  test 'setting the banner' do
103
108
  slop = Slop.new
104
109
  slop.banner = "foo bar"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: slop
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.5.4
5
+ version: 1.5.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Lee Jarvis
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-01 00:00:00 +01:00
13
+ date: 2011-05-03 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies: []
16
16