slop 3.0.1 → 3.0.2

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.
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
- HEAD
2
- ----
1
+ 3.0.2 (2012-01-27)
2
+ ------------------
3
+
4
+ * Ensure `--option=value` is being evaluated before multiple switches (#52)
5
+
6
+ 3.0.1 (2012-01-27)
7
+ ------------------
3
8
 
4
9
  * Ensure tests run green on 1.8.7
5
10
  * Ensure `:argument => :optional` works with `:option=` format.
@@ -4,7 +4,7 @@ require 'slop/commands'
4
4
  class Slop
5
5
  include Enumerable
6
6
 
7
- VERSION = '3.0.1'
7
+ VERSION = '3.0.2'
8
8
 
9
9
  # The main Error class, all Exception classes inherit from this class.
10
10
  class Error < StandardError; end
@@ -403,9 +403,7 @@ class Slop
403
403
  @trash << index
404
404
  @triggered_options << option
405
405
 
406
- if config[:multiple_switches] && argument
407
- execute_multiple_switches(option, argument, index)
408
- elsif option.expects_argument?
406
+ if option.expects_argument?
409
407
  argument ||= items.at(index + 1)
410
408
 
411
409
  if !argument || argument =~ /\A--?[a-zA-Z][a-zA-Z0-9_-]*\z/
@@ -421,6 +419,8 @@ class Slop
421
419
  else
422
420
  option.call(nil)
423
421
  end
422
+ elsif config[:multiple_switches] && argument
423
+ execute_multiple_switches(option, argument, index)
424
424
  else
425
425
  option.call(nil)
426
426
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'slop'
3
- s.version = '3.0.1'
3
+ s.version = '3.0.2'
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'
@@ -43,6 +43,12 @@ class SlopTest < TestCase
43
43
  assert_equal [nil, 'foo', nil, {:optional_argument=>true}], build_option('foo=?')
44
44
  end
45
45
 
46
+ test "parsing option=value" do
47
+ slop = Slop.new { on :foo= }
48
+ slop.parse %w' --foo=bar '
49
+ assert_equal 'bar', slop[:foo]
50
+ end
51
+
46
52
  test "fetch_option" do
47
53
  slop = Slop.new
48
54
  opt1 = slop.on :f, :foo
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.1
4
+ version: 3.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: