slop 2.4.1 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGES.md +5 -0
  2. data/lib/slop.rb +4 -6
  3. data/slop.gemspec +1 -1
  4. metadata +3 -3
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 2.4.2 (2011-12-18)
2
+ ------------------
3
+
4
+ * Fix checking of required options (Dominik Honnef)
5
+
1
6
  2.4.1 (2011-12-08)
2
7
  ------------------
3
8
 
data/lib/slop.rb CHANGED
@@ -2,7 +2,7 @@ class Slop
2
2
  include Enumerable
3
3
 
4
4
  # @return [String] The current version string
5
- VERSION = '2.4.1'
5
+ VERSION = '2.4.2'
6
6
 
7
7
  # Slops standard Error class. All exception classes should
8
8
  # inherit from this class
@@ -229,9 +229,7 @@ class Slop
229
229
  private
230
230
 
231
231
  def arg_value(value)
232
- if accepts_optional_argument? || expects_argument?
233
- value
234
- end
232
+ value if accepts_optional_argument? || expects_argument?
235
233
  end
236
234
 
237
235
  def value_to_range(value)
@@ -881,7 +879,7 @@ class Slop
881
879
 
882
880
  def raise_if_missing_required_options!(items)
883
881
  @options.select(&:required).each do |o|
884
- unless items.select {|i| i[/\A--?/] }.any? {|i| i.to_s.sub(/\A--?/, '') == o.key }
882
+ if o.argument_value.nil?
885
883
  raise MissingOptionError, "Expected option `#{o.key}` is required"
886
884
  end
887
885
  end
@@ -1048,4 +1046,4 @@ class Slop
1048
1046
  options.push((@arguments || extras[:argument]) ? true : (args.shift ? true : false))
1049
1047
  options.push extras
1050
1048
  end
1051
- end
1049
+ end
data/slop.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'slop'
3
- s.version = '2.4.1'
3
+ s.version = '2.4.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'
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: 2.4.1
4
+ version: 2.4.2
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: 2011-12-08 00:00:00.000000000Z
12
+ date: 2011-12-18 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
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 1.8.10
51
+ rubygems_version: 1.8.11
52
52
  signing_key:
53
53
  specification_version: 3
54
54
  summary: Option gathering made easy