slop 4.4.0 → 4.4.1

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 (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/lib/slop.rb +5 -1
  4. data/test/slop_test.rb +17 -0
  5. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 496c3e58ee49a489dc45b3885c49b32367ad0fe5
4
- data.tar.gz: 7efe7c13f5992f1533486adf452c904f1f4b1981
3
+ metadata.gz: de2091f9afde594e40aac061706815b7136bbf2c
4
+ data.tar.gz: 9ba238ffb27744cbf3293cb532824f18a10f5e7e
5
5
  SHA512:
6
- metadata.gz: 4b1905b9eefaee4c30dd96eb94a6e1740700c2b370e37230869d1d8ccd4679ae6ea5924ae3f72e0f9be97d21c020003ce875c7eb5a4c75f958ddd1da07110ea6
7
- data.tar.gz: ab9fcf28c51edeece517285cdeb33a82fdf4e1a51e853bf94ae2594ea60d1a405cd665b1161871e5ed43717f5b57f157d30814396d8a53c09d82177f0fa0bc87
6
+ metadata.gz: a9701396bf3f9e1def3dbf17d38446f96ea560b7a046a3cab55783d053212a019a8f75102550dc67baf0df8b793dae0466ff1332fb0e42d0387cda143bdf20c2
7
+ data.tar.gz: dbb443da3652723951432d1603bbf2fe614335ea0c7605d5e9bdffb04f06c5f4042bed5fe2880f64d3fec978bd14aef006fdb2946359e6db0368557bae12dda5
@@ -1,6 +1,13 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v4.4.1 (2016-08-21)
5
+ -------------------
6
+
7
+ Bug fixes:
8
+ * Handle bad constant names in `Slop.option_defined?`. #198
9
+ (Ellen Marie Dash)
10
+
4
11
  v4.4.0 (2016-08-15)
5
12
  -------------------
6
13
 
@@ -6,7 +6,7 @@ require 'slop/types'
6
6
  require 'slop/error'
7
7
 
8
8
  module Slop
9
- VERSION = '4.4.0'
9
+ VERSION = '4.4.1'
10
10
 
11
11
  # Parse an array of options (defaults to ARGV). Accepts an
12
12
  # optional hash of configuration options and block.
@@ -31,6 +31,10 @@ module Slop
31
31
  # Returns true if an option is defined.
32
32
  def self.option_defined?(name)
33
33
  const_defined?(string_to_option(name.to_s))
34
+ rescue NameError
35
+ # If a NameError is raised, it wasn't a valid constant name,
36
+ # and thus couldn't have been defined.
37
+ false
34
38
  end
35
39
 
36
40
  # Example:
@@ -0,0 +1,17 @@
1
+ require "test_helper"
2
+
3
+ describe Slop do
4
+ describe ".option_defined?" do
5
+ it "handles bad constant names" do
6
+ assert_equal false, Slop.option_defined?("Foo?Bar")
7
+ end
8
+
9
+ it "returns false if the option is not defined" do
10
+ assert_equal false, Slop.option_defined?("Foo")
11
+ end
12
+
13
+ it "returns true if the option is defined" do
14
+ assert_equal true, Slop.option_defined?("String")
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slop
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Jarvis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -64,6 +64,7 @@ files:
64
64
  - test/options_test.rb
65
65
  - test/parser_test.rb
66
66
  - test/result_test.rb
67
+ - test/slop_test.rb
67
68
  - test/test_helper.rb
68
69
  - test/types_test.rb
69
70
  homepage: http://github.com/leejarvis/slop
@@ -96,6 +97,7 @@ test_files:
96
97
  - test/options_test.rb
97
98
  - test/parser_test.rb
98
99
  - test/result_test.rb
100
+ - test/slop_test.rb
99
101
  - test/test_helper.rb
100
102
  - test/types_test.rb
101
103
  has_rdoc: