strict_options 0.1.0
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 +7 -0
- data/lib/strict_options.rb +14 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 849eff2ed6014a40a64f6987d4e8fcf002f401d4
|
4
|
+
data.tar.gz: 0729bbb1f779ebf0966cfb04ea430899b44a28be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1731830bef65f8046b45322f2c9088059ab156f5e0dd0cee65d2fccb6fe4e53d57100d658731b34c966a93f2804e8f75549e3032a019453f88255ed426946977
|
7
|
+
data.tar.gz: 3912660f45d0ef60e4e6f9996c8232c7a4849c8ea027da6ae9b9816600e31af5ec0140289e06742bc2e29bd69af4891a8c267fff049f8122719f7f3983ce4232
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module StrictOptions
|
2
|
+
def strict_options!(*opts)
|
3
|
+
@missings = []
|
4
|
+
opts.each { |opt| @missings << ":#{opt}" unless @options[opt] }
|
5
|
+
|
6
|
+
raise ArgumentError, "options #{@missings.join(', ')} #{is_or_are} missing" if @missings.size > 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_or_are
|
10
|
+
return if @missings.empty?
|
11
|
+
|
12
|
+
@missings.size > 1 ? 'are' : 'is'
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: strict_options
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Volodya Sveredyuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.4.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
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
|
+
description: Define strict attributes for options hash
|
48
|
+
email: sveredyuk@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- lib/strict_options.rb
|
54
|
+
homepage: https://github.com/sveredyuk/strict_options
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.4.5.1
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Define strict attributes for options hash
|
78
|
+
test_files: []
|