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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/slop.rb +5 -1
- data/test/slop_test.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de2091f9afde594e40aac061706815b7136bbf2c
|
4
|
+
data.tar.gz: 9ba238ffb27744cbf3293cb532824f18a10f5e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9701396bf3f9e1def3dbf17d38446f96ea560b7a046a3cab55783d053212a019a8f75102550dc67baf0df8b793dae0466ff1332fb0e42d0387cda143bdf20c2
|
7
|
+
data.tar.gz: dbb443da3652723951432d1603bbf2fe614335ea0c7605d5e9bdffb04f06c5f4042bed5fe2880f64d3fec978bd14aef006fdb2946359e6db0368557bae12dda5
|
data/CHANGELOG.md
CHANGED
data/lib/slop.rb
CHANGED
@@ -6,7 +6,7 @@ require 'slop/types'
|
|
6
6
|
require 'slop/error'
|
7
7
|
|
8
8
|
module Slop
|
9
|
-
VERSION = '4.4.
|
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:
|
data/test/slop_test.rb
ADDED
@@ -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.
|
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-
|
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:
|