slop 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ 3.0.3 (2012-01-30)
2
+ ------------------
3
+
4
+ * Ensure options passed after option terminator do not raise an exception
5
+ (#54, Amon Sha)
6
+
1
7
  3.0.2 (2012-01-27)
2
8
  ------------------
3
9
 
data/lib/slop.rb CHANGED
@@ -4,7 +4,7 @@ require 'slop/commands'
4
4
  class Slop
5
5
  include Enumerable
6
6
 
7
- VERSION = '3.0.2'
7
+ VERSION = '3.0.3'
8
8
 
9
9
  # The main Error class, all Exception classes inherit from this class.
10
10
  class Error < StandardError; end
@@ -367,7 +367,8 @@ class Slop
367
367
  @trash << index && break if item == '--'
368
368
  autocreate(items, index) if config[:autocreate]
369
369
  process_item(items, index, &block) unless @trash.include?(index)
370
- }.reject!.with_index { |item, index| delete && @trash.include?(index) }
370
+ }
371
+ items.reject!.with_index { |item, index| delete && @trash.include?(index) }
371
372
 
372
373
  required_options = options.select { |opt| opt.required? && opt.count < 1 }
373
374
  if required_options.any?
@@ -571,4 +572,4 @@ class Slop
571
572
  object.to_s.sub(/\A--?/, '')
572
573
  end
573
574
 
574
- end
575
+ end
data/slop.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'slop'
3
- s.version = '3.0.2'
3
+ s.version = '3.0.3'
4
4
  s.summary = 'Option gathering made easy'
5
5
  s.description = 'A simple DSL for gathering options and parsing the command line'
6
6
  s.author = 'Lee Jarvis'
data/test/slop_test.rb CHANGED
@@ -177,6 +177,13 @@ class SlopTest < TestCase
177
177
  refute opts.fetch_option(:baz).expects_argument?
178
178
  end
179
179
 
180
+ test "option terminator" do
181
+ opts = Slop.new { on :foo= }
182
+ items = %w' foo -- --foo bar '
183
+ opts.parse! items
184
+ assert_equal %w' foo --foo bar ', items
185
+ end
186
+
180
187
  test "raising an InvalidArgumentError when the argument doesn't match" do
181
188
  opts = Slop.new { on :foo=, :match => /^[a-z]+$/ }
182
189
  assert_raises(Slop::InvalidArgumentError) { opts.parse %w' --foo b4r '}
@@ -290,4 +297,4 @@ class SlopTest < TestCase
290
297
  end
291
298
  end
292
299
 
293
- end
300
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slop
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-27 00:00:00.000000000 Z
12
+ date: 2012-01-30 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A simple DSL for gathering options and parsing the command line
15
15
  email: lee@jarvis.co