opt_parse_validator 0.0.17.0 → 0.0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/opt_parse_validator/config_files_loader_merger/base.rb +2 -0
- data/lib/opt_parse_validator/config_files_loader_merger/json.rb +2 -0
- data/lib/opt_parse_validator/config_files_loader_merger/yml.rb +2 -0
- data/lib/opt_parse_validator/config_files_loader_merger.rb +2 -0
- data/lib/opt_parse_validator/errors.rb +2 -0
- data/lib/opt_parse_validator/hacks.rb +2 -0
- data/lib/opt_parse_validator/opts/alias.rb +2 -0
- data/lib/opt_parse_validator/opts/array.rb +2 -0
- data/lib/opt_parse_validator/opts/base.rb +2 -0
- data/lib/opt_parse_validator/opts/boolean.rb +2 -0
- data/lib/opt_parse_validator/opts/choice.rb +3 -1
- data/lib/opt_parse_validator/opts/credentials.rb +2 -0
- data/lib/opt_parse_validator/opts/directory_path.rb +2 -0
- data/lib/opt_parse_validator/opts/file_path.rb +2 -0
- data/lib/opt_parse_validator/opts/headers.rb +2 -0
- data/lib/opt_parse_validator/opts/integer.rb +2 -0
- data/lib/opt_parse_validator/opts/integer_range.rb +2 -0
- data/lib/opt_parse_validator/opts/multi_choices.rb +3 -1
- data/lib/opt_parse_validator/opts/path.rb +2 -0
- data/lib/opt_parse_validator/opts/positive_integer.rb +2 -0
- data/lib/opt_parse_validator/opts/proxy.rb +2 -0
- data/lib/opt_parse_validator/opts/regexp.rb +2 -0
- data/lib/opt_parse_validator/opts/smart_list.rb +2 -0
- data/lib/opt_parse_validator/opts/string.rb +2 -0
- data/lib/opt_parse_validator/opts/uri.rb +5 -3
- data/lib/opt_parse_validator/opts/url.rb +2 -0
- data/lib/opt_parse_validator/opts.rb +2 -0
- data/lib/opt_parse_validator/version.rb +3 -1
- data/lib/opt_parse_validator.rb +2 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5395143bb809bb24d61fb417e7833884059301bb105ce7048525f164091b28b1
|
4
|
+
data.tar.gz: 9678e2af54bb6fbdca0763277a2ddfb24c4760d29e545f2935c2413f2b1ae1a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f1c685f63ba8ff70ad67a5df1678e72b898e06a7d5ea70f0d068afb7a30cb2b195f643a40daa1864efc7eeaaeb6d6473d3e9af240098b24f27cb1e62acbdf3b
|
7
|
+
data.tar.gz: 4b296611ecad07d1be4adee75685edfe4cb61dc7413bb734153c7fbbece7fbd1f04f56c15ef2a2916b214cf21670bed4316f710f2c7daf24af4ac24afab16e92
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OptParseValidator
|
2
4
|
# Implementation of the Choice Option
|
3
5
|
class OptChoice < OptBase
|
@@ -23,7 +25,7 @@ module OptParseValidator
|
|
23
25
|
# If :case_sensitive if false (or nil), the downcased value of the choice
|
24
26
|
# will be returned
|
25
27
|
def validate(value)
|
26
|
-
value = value.to_s
|
28
|
+
value = +value.to_s
|
27
29
|
|
28
30
|
unless attrs[:case_sensitive]
|
29
31
|
value.downcase!
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OptParseValidator
|
2
4
|
# Implementation of the MultiChoices Option
|
3
5
|
class OptMultiChoices < OptArray
|
@@ -37,7 +39,7 @@ module OptParseValidator
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def help_message_for_default
|
40
|
-
msg = ''
|
42
|
+
msg = +''
|
41
43
|
|
42
44
|
default.each do |key, value|
|
43
45
|
msg << if value == true
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OptParseValidator
|
2
4
|
# Implementation of the URI Option
|
3
5
|
class OptURI < OptBase
|
@@ -11,12 +13,12 @@ module OptParseValidator
|
|
11
13
|
|
12
14
|
# @return [ Array<String> ]
|
13
15
|
def allowed_protocols
|
14
|
-
@allowed_protocols ||= [*attrs[:protocols]]
|
16
|
+
@allowed_protocols ||= [*attrs[:protocols]].map(&:downcase)
|
15
17
|
end
|
16
18
|
|
17
19
|
# The default protocol (or scheme) to use if none was given
|
18
20
|
def default_protocol
|
19
|
-
@default_protocol ||= attrs[:default_protocol]
|
21
|
+
@default_protocol ||= attrs[:default_protocol]&.downcase
|
20
22
|
end
|
21
23
|
|
22
24
|
# @param [ String ] value
|
@@ -27,7 +29,7 @@ module OptParseValidator
|
|
27
29
|
|
28
30
|
uri = Addressable::URI.parse("#{default_protocol}://#{value}") if !uri.scheme && default_protocol
|
29
31
|
|
30
|
-
unless allowed_protocols.empty? || allowed_protocols.include?(uri.scheme)
|
32
|
+
unless allowed_protocols.empty? || allowed_protocols.include?(uri.scheme&.downcase)
|
31
33
|
# For future refs: will have to check if the uri.scheme exists,
|
32
34
|
# otherwise it means that the value was empty
|
33
35
|
raise Addressable::URI::InvalidURIError
|
data/lib/opt_parse_validator.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opt_parse_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.17.
|
4
|
+
version: 0.0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WPScanTeam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -126,14 +126,14 @@ dependencies:
|
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.
|
129
|
+
version: 0.66.0
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: 0.
|
136
|
+
version: 0.66.0
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: simplecov
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,8 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
|
-
|
210
|
-
rubygems_version: 2.6.10
|
209
|
+
rubygems_version: 3.0.3
|
211
210
|
signing_key:
|
212
211
|
specification_version: 4
|
213
212
|
summary: Ruby OptionParser Validators
|