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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e322daa4a45ff87f3fccdd1f087509f33326015b4b0af1a574fbe35734a13f05
4
- data.tar.gz: 0f778a412f222d3ce9acecd846d63868c1882756a6a4068e30c9f71c5b649ff0
3
+ metadata.gz: 624a80ddabb8e69e586c3350a22bab9717af67818b97618425f0093606b684a6
4
+ data.tar.gz: bce074ab33e21da81a969cd0e780c1b296a7ec0e8b4a738cd3e08da098add826
5
5
  SHA512:
6
- metadata.gz: 0f163a5ef25f963c8a61d4f86711fff0d255b47265372f51e18db446548cef81208ab75cdc666db4b9d804487417a433adbe15bd59e3cb349dee6f7e8c5d6042
7
- data.tar.gz: 0ed8a0de01b76b888e010da5d5ebe9c698fc2906fa67ca3a5ae672e67f7c01058bc803386473749a223511447d1829fe568cb5db59c391bd6e7d9f0176942a6b
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.
@@ -3,6 +3,6 @@
3
3
  module Params
4
4
  class Registry
5
5
  # The module version
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.3"
7
7
  end
8
8
  end
@@ -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.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-01-30 00:00:00.000000000 Z
11
+ date: 2024-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-types