strict_options 0.1.0 → 0.1.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/lib/strict_options.rb +9 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd48360a5944716f242f2c5cc9f260262cad9c16
|
4
|
+
data.tar.gz: 8244ea83be1f05bf434c302ff9b569302f691bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d59a551d0682b058f236e00074300d70f9246c078cbd561fbfb55dba18c11159be4ec51f183ac443d3f8776d72da9fa9f23bf9ca1116594d45db6d4b75619a1a
|
7
|
+
data.tar.gz: 6c998326ab88f07711277e10e639f976073cc8e20be3bb02bceb852c8f88caa4f94e3fe057af161547d9303007639298907ebbeb74ca7ebdebc451effb77780b
|
data/lib/strict_options.rb
CHANGED
@@ -3,12 +3,20 @@ module StrictOptions
|
|
3
3
|
@missings = []
|
4
4
|
opts.each { |opt| @missings << ":#{opt}" unless @options[opt] }
|
5
5
|
|
6
|
-
raise ArgumentError, "
|
6
|
+
raise ArgumentError, "option#{s} #{@missings.join(', ')} #{is_or_are} missing" if @missings.size > 0
|
7
7
|
end
|
8
8
|
|
9
|
+
private
|
10
|
+
|
9
11
|
def is_or_are
|
10
12
|
return if @missings.empty?
|
11
13
|
|
12
14
|
@missings.size > 1 ? 'are' : 'is'
|
13
15
|
end
|
16
|
+
|
17
|
+
def s
|
18
|
+
return if @missings.empty?
|
19
|
+
|
20
|
+
@missings.size > 1 ? 's' : ''
|
21
|
+
end
|
14
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strict_options
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volodya Sveredyuk
|
@@ -30,20 +30,6 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 3.4.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: pry-rails
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
40
|
-
type: :development
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
33
|
description: Define strict attributes for options hash
|
48
34
|
email: sveredyuk@gmail.com
|
49
35
|
executables: []
|
@@ -74,5 +60,5 @@ rubyforge_project:
|
|
74
60
|
rubygems_version: 2.4.5.1
|
75
61
|
signing_key:
|
76
62
|
specification_version: 4
|
77
|
-
summary:
|
63
|
+
summary: Strict for options hash
|
78
64
|
test_files: []
|