params-registry 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/params/registry/template.rb +21 -0
- data/lib/params/registry/version.rb +1 -1
- data/lib/params/registry.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b59f44588d91a5931a029450ff4087f634a8e4c4f92d5fc07ed593b616ddda1
|
4
|
+
data.tar.gz: 524ee99633bd8f266acca27eb9f712bbdb3d64b02291e09848e2efb4b694db29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6929a5621c8a7fc76f64104fceaca556d00013a06465077fc47e328bc48dedda7668cd19b28f9a70bd63d3ae27fb19884ae4f327f74253b3a66bfd5e202975b3
|
7
|
+
data.tar.gz: a309df26a0e9f3050f7c234b65a98cee13e32b038a1369479c5ad3c7c7e9ab2836542be35f9948716b74febbb5f48cfe896a6c5b2d47e4bcdf1c4d470cca3204
|
@@ -11,6 +11,13 @@ class Params::Registry::Template
|
|
11
11
|
# this is dumb
|
12
12
|
Types = Params::Registry::Types
|
13
13
|
|
14
|
+
# Post-initialization hook for subclasses, because the constructor
|
15
|
+
# is so hairy.
|
16
|
+
#
|
17
|
+
# @return [void]
|
18
|
+
#
|
19
|
+
def post_init; end
|
20
|
+
|
14
21
|
public
|
15
22
|
|
16
23
|
# Initialize the template object.
|
@@ -81,6 +88,8 @@ class Params::Registry::Template
|
|
81
88
|
@unwind = Types::Proc[unwind] if unwind
|
82
89
|
@reverse = Types::Bool[reverse]
|
83
90
|
|
91
|
+
# post-initialization hook
|
92
|
+
post_init
|
84
93
|
end
|
85
94
|
|
86
95
|
# @!attribute [r] registry
|
@@ -212,6 +221,18 @@ class Params::Registry::Template
|
|
212
221
|
#
|
213
222
|
def complement? ; !!@complement; end
|
214
223
|
|
224
|
+
# @!attribute [r] blank?
|
225
|
+
# Returns true if the template has no configuration data to speak of.
|
226
|
+
# @return [Boolean]
|
227
|
+
def blank?
|
228
|
+
# XXX PHEWWW
|
229
|
+
@slug.nil? && @type == Types::NormalizedString && @composite.nil? &&
|
230
|
+
@format.nil? && @aliases.empty? && @depends.empty? &&
|
231
|
+
@conflicts.empty? && @consumes.empty? && @preproc.nil? &&
|
232
|
+
@min == 0 && @max.nil? && !@shift && !@empty && @default.nil? &&
|
233
|
+
@unifunc.nil? && @complement.nil? && @unwind.nil? && !@reverse
|
234
|
+
end
|
235
|
+
|
215
236
|
# Preprocess a parameter value against itself and/or `consume`d values.
|
216
237
|
#
|
217
238
|
# @param myself [Array] raw values for the parameter itself.
|
data/lib/params/registry.rb
CHANGED
@@ -327,7 +327,7 @@ class Params::Registry
|
|
327
327
|
# the null id is special; you can't assign to it
|
328
328
|
id = Types::NonNil[id]
|
329
329
|
|
330
|
-
@groups[id] =
|
330
|
+
@groups[id] = group_class.new self, id, templates: spec
|
331
331
|
end
|
332
332
|
|
333
333
|
# Retrieve the names of the groups.
|