params-registry 0.1.1 → 0.1.3
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 +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 624a80ddabb8e69e586c3350a22bab9717af67818b97618425f0093606b684a6
|
4
|
+
data.tar.gz: bce074ab33e21da81a969cd0e780c1b296a7ec0e8b4a738cd3e08da098add826
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d50aa5edb159bc4159b6d93abe11ef251c2a571bc5a2d3935bb17e743e5027aae20caa9ce757be82b70c77cdfbaea6464afd969da77813fbe44efa2b18ce9ea7
|
7
|
+
data.tar.gz: d893ba746adaa6cdf04f17022f31452ed88a506c70f1060e519603627784ed3e51d0e7cd52a52d14a66d43882c5ab7d6bb9da2c76cd52e8798d0b36f5c9f1157
|
@@ -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
@@ -129,6 +129,12 @@ class Params::Registry
|
|
129
129
|
#
|
130
130
|
def keys ; @templates.keys; end
|
131
131
|
|
132
|
+
# Return the template entries, in order.
|
133
|
+
#
|
134
|
+
# @return [Array<Params::Registry::Template>] the templates.
|
135
|
+
#
|
136
|
+
def templates ; @templates.values; end
|
137
|
+
|
132
138
|
# Return the canonical identifier for the template.
|
133
139
|
#
|
134
140
|
# @param id [Object] the identifier, canonical or otherwise.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: params-registry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-types
|