abide_dev_utils 0.18.8 → 0.18.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cb0e7cb6db8088427a363ca729869313ff57f0ebcdec8540682701fa2931215
4
- data.tar.gz: c0e17b9d42924997146bf6b222ca39cab6ce6799b4d0bee4d0bd94186b0da307
3
+ metadata.gz: 8cfa1f253500e43f42a6fa53de2da238f79ac12dc286c945488b8e521b2b7868
4
+ data.tar.gz: f357e24f825f8ffd304fe779f390ea5bdc00c0fb06bef9a6d7e2d228759ecb05
5
5
  SHA512:
6
- metadata.gz: 7a7eea4740d5d5a5c7429d8b6b474fe144f6e768117e9f00eed7d87ad76f9a8cfd8cde76ab9ca5e97ac224f99131872db21922036a1321d14d4eee2dab99665e
7
- data.tar.gz: d1ffabdb664b9d431d2e0ed65c5d32442829359f8bcb2c866b6c3f89a8e44a224631bc40b85f90ff6ce31646fa22b68254f606f6d7e5394a43520a062ec328cc
6
+ metadata.gz: 45dc1ae54c5b5f0486d889d18151269105938abe5fc1a55c7d7bf0a6d9f62e4cd39d36c7fa2ee7d27cbb36c099fd237da605f7f528823869c34004e023c0f745
7
+ data.tar.gz: d7474b5c61a1ee3249fa2eaa70ad63123b2509b79757cbbf3cef7c7cd858e8e0cc2f047a4917ab073693459874f61f26d0c4e55e3e5664f6e80a29092c9deee9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- abide_dev_utils (0.18.8)
4
+ abide_dev_utils (0.18.9)
5
5
  cmdparse (~> 3.0)
6
6
  facterdb (~> 4.1.0)
7
7
  google-cloud-storage (~> 1.34)
@@ -324,7 +324,9 @@ module AbideDevUtils
324
324
  @control_data[ctrl_param[:name]][:default] = ctrl_param[:default] || rsrc_param&.value
325
325
  return unless @control_data[ctrl_param[:name]][:default]
326
326
 
327
- " - #{@md.italic('Default:')} #{@md.code(@control_data[ctrl_param[:name]][:default])}"
327
+ default = @control_data[ctrl_param[:name]][:default]
328
+ default_str = [Hash, Array].any? { |t| default.is_a?(t) } ? @formatter.yaml_flow(default) : default
329
+ " - #{@md.italic('Default:')} #{@md.code(default_str)}"
328
330
  end
329
331
 
330
332
  def param_description(ctrl_param)
@@ -467,18 +469,39 @@ module AbideDevUtils
467
469
  end
468
470
  end
469
471
 
470
- # Escapes and quotes a string. If value is not a string, returns value.
471
- # @param value [Any] the string to quote.
472
- # @return [String] the quoted string.
473
- # @return [Any] the value if it is not a string.
472
+ # Escapes and quotes a string. Hash and Array values are formatted as
473
+ # YAML flow-style so they produce valid YAML when embedded in a code block.
474
+ # @param value [Any] the value to quote.
475
+ # @return [String] the quoted/formatted value.
474
476
  def self.quote(value)
475
- if value.is_a?(String)
477
+ case value
478
+ when String
476
479
  value.inspect
480
+ when Hash, Array
481
+ yaml_flow(value)
477
482
  else
478
483
  value
479
484
  end
480
485
  end
481
486
 
487
+ # Recursively formats a Hash or Array as a YAML flow-style scalar so it
488
+ # can be embedded inline in a YAML code block without Ruby hash-rocket syntax.
489
+ # @param value [Any] the value to format.
490
+ # @return [String] the YAML flow-style representation.
491
+ def self.yaml_flow(value)
492
+ case value
493
+ when Hash
494
+ pairs = value.map { |k, v| "#{k}: #{yaml_flow(v)}" }.join(', ')
495
+ "{#{pairs}}"
496
+ when Array
497
+ "[#{value.map { |v| yaml_flow(v) }.join(', ')}]"
498
+ when String
499
+ value
500
+ else
501
+ value.to_s
502
+ end
503
+ end
504
+
482
505
  # Checks if a value is considered undef.
483
506
  # @param value [Any] the value to check.
484
507
  # @return [Boolean] true if value is considered undef (nil or 'undef').
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AbideDevUtils
4
- VERSION = "0.18.8"
4
+ VERSION = "0.18.9"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abide_dev_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.8
4
+ version: 0.18.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - abide-team
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-06-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nokogiri
@@ -478,7 +477,6 @@ metadata:
478
477
  source_code_uri: https://github.com/puppetlabs/abide_dev_utils
479
478
  changelog_uri: https://github.com/puppetlabs/abide_dev_utils
480
479
  rubygems_mfa_required: 'true'
481
- post_install_message:
482
480
  rdoc_options: []
483
481
  require_paths:
484
482
  - lib
@@ -493,8 +491,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
493
491
  - !ruby/object:Gem::Version
494
492
  version: '0'
495
493
  requirements: []
496
- rubygems_version: 3.5.22
497
- signing_key:
494
+ rubygems_version: 3.6.9
498
495
  specification_version: 4
499
496
  summary: Helper utilities for developing compliance Puppet code
500
497
  test_files: []