params-registry 0.1.7 → 0.1.8

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: a176c219561e992201c81af4cfa87b348fd408a5d52121ae9483004fdf073af3
4
- data.tar.gz: 3d532a4041860f3c09df1c5802e3e4dc27931cd98e13b1a5355f9251a7c73f83
3
+ metadata.gz: bcd8659d212d3467f58e09a552bc105d50e35bea4c695c40f9de744a978e4697
4
+ data.tar.gz: 03522f0aec72a7d4e3d329051ba18c60a6846cf96e1dfadc8efdea86c801f3d0
5
5
  SHA512:
6
- metadata.gz: 52eda8b9e02f1f82dd908a07d5c2f4f1179ec2a401dff5562b582f55bdc4989d11ae5956664784fc1dfcd58ccaa5d6899aa0d651794021f408e9c0e84c65c188
7
- data.tar.gz: bf940c462597a0c43123e72f795e17f7778ff7ec2b73c7b9bcaea5c2e09b3a7472767342a12d4d155321c1033cf291571a0d91158745c6bae09af7f33f49ec4e
6
+ metadata.gz: 8e99fd842ae67daa05f39b60832f2ed03c1446b52b856ac6f661f7b3280cb567b0e7597d0d2f45c288542f14c188ab5be331a3989466c72378bbfdb213b2fca7
7
+ data.tar.gz: f5f0adaa738a61a7556c7e3e7f8eefccb498b0d835b6c774f56702ea938b8b02827f9c5d1f8289668b4d1719422febb8073b140737ce346c197fdeda34132d9c
@@ -74,16 +74,16 @@ class Params::Registry::Instance
74
74
  @content = {}
75
75
  @extra = {}
76
76
 
77
- warn "wtf lol #{@registry[@group].inspect}"
77
+ # warn "wtf lol #{@registry[@group].inspect}"
78
78
 
79
79
  # canonicalize the keys of the struct
80
80
  struct = Types::Input[struct].reduce({}) do |hash, pair|
81
81
  key, value = pair
82
82
  if t = @registry[@group][key]
83
- warn "yep #{key.inspect}"
83
+ # warn "yep #{key.inspect}"
84
84
  hash[t.id] = value
85
85
  else
86
- warn "nope #{key.inspect}"
86
+ # warn "nope #{key.inspect}"
87
87
  @extra[key] = value
88
88
  end
89
89
 
@@ -182,13 +182,15 @@ class Params::Registry::Instance
182
182
  # @return [Hash] basically the same thing, minus its metadata.
183
183
  #
184
184
  def to_h slugs: true, extra: false
185
- # we're gonna do damage, lol
186
- out = @content.dup
185
+ g = registry[@group]
187
186
 
188
- # this should work?
189
- out.transform_keys! do |k|
190
- registry[@group][k].slug || k.to_s.to_sym
191
- end if slugs
187
+ out = {}
188
+
189
+ g.templates.each do |t|
190
+ next unless @content.key? t.id
191
+ key = slugs ? t.slug || t.id.to_s.to_sym : t.id
192
+ out[key] = @content[t.id]
193
+ end
192
194
 
193
195
  # XXX maybe enforce the ordering better??
194
196
  out.merge! @extra if extra
@@ -196,18 +198,18 @@ class Params::Registry::Instance
196
198
  out
197
199
  end
198
200
 
199
- # Retrieve an {Params::Registry::Instance} that isolates the
200
- # intersection of one or more groups
201
- #
202
- # @param group [Object] the group identifier.
203
- # @param extra [false, true] whether to include any "extra" unparsed
204
- # parameters.
205
- #
206
- # @return [Params::Registry::Instance] an instance containing just
207
- # the group(s) identified.
208
- #
209
- def group *group, extra: false
210
- end
201
+ # # Retrieve an {Params::Registry::Instance} that isolates the
202
+ # # intersection of one or more groups
203
+ # #
204
+ # # @param group [Object] the group identifier.
205
+ # # @param extra [false, true] whether to include any "extra" unparsed
206
+ # # parameters.
207
+ # #
208
+ # # @return [Params::Registry::Instance] an instance containing just
209
+ # # the group(s) identified.
210
+ # #
211
+ # def group *group, extra: false
212
+ # end
211
213
 
212
214
  # Serialize the instance back to a {::URI} query string.
213
215
  #
@@ -3,6 +3,6 @@
3
3
  module Params
4
4
  class Registry
5
5
  # The module version
6
- VERSION = "0.1.7"
6
+ VERSION = "0.1.8"
7
7
  end
8
8
  end
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.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Taylor