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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 155fe142e33362d910c2682c207d9c01dd2ecdccfeaeec4b6953da96825e33d6
4
- data.tar.gz: 7a991e0a0b3d5552251bdc26912261561acf0667f6bfbf5b7996c43cf8b577d8
3
+ metadata.gz: 2b59f44588d91a5931a029450ff4087f634a8e4c4f92d5fc07ed593b616ddda1
4
+ data.tar.gz: 524ee99633bd8f266acca27eb9f712bbdb3d64b02291e09848e2efb4b694db29
5
5
  SHA512:
6
- metadata.gz: 7c1c7aa4cadcf3d98642a2bad6ef69f2fdb6001b331631e9e7be07f46e210e2876168256323bf6bc34147e1e61a802a85c5acd8872c6db8bb19744926811fcc2
7
- data.tar.gz: bc76e72afde35988ee907f3e54fdae0a2b4b4afbe64d05da0a5808a8e16bad87b3925347e7abd30efc10bfaf902479a91e6e69e35d74d9d4428285910f0e46b1
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.
@@ -3,6 +3,6 @@
3
3
  module Params
4
4
  class Registry
5
5
  # The module version
6
- VERSION = "0.1.2"
6
+ VERSION = "0.1.4"
7
7
  end
8
8
  end
@@ -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] = Group.new self, id, templates: spec
330
+ @groups[id] = group_class.new self, id, templates: spec
331
331
  end
332
332
 
333
333
  # Retrieve the names of the groups.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: params-registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Taylor