kube_schema 1.12.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,24 +16,23 @@ class Hash
16
16
  end
17
17
  end
18
18
 
19
- #def respond_to_missing(name, _priv = false)
20
- # name.to_s.end_with?("=") || key?(name.to_sym)
21
- #end
22
-
23
19
  # Build a Hash with autovivification via a block DSL.
20
+ # @yields {} a block evaluated against the new Hash.
21
+ # @returns [Hash] the Hash built by the block.
24
22
  #
23
+ # @example
25
24
  # Hash.vivify {
26
25
  # metadata.name = "web"
27
26
  # spec.replicas = 3
28
27
  # spec.selector.matchLabels.app = "web"
29
28
  # }
30
29
  # # => { metadata: { name: "web" }, spec: { replicas: 3, selector: { matchLabels: { app: "web" } } } }
31
- #
32
30
  def self.vivify(&block)
33
31
  new.tap { |h| h.instance_exec(&block) }
34
32
  end
35
33
 
36
- # Deep-stringify keys so symbol keys don't leak into YAML as `:key:`.
34
+ # Stringify keys so symbols don't leak into YAML as `:key:`.
35
+ # @returns [String] the Hash dumped as YAML.
37
36
  def to_yaml(*)
38
37
  Hash._deep_stringify_keys(self).then { |h| Psych.dump(h) }
39
38
  end