patchyaml 0.1.2 → 0.1.3

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: '09030d2cd8460fc135a5b74cc74277933efb7b9ba90c2cfa59fe14ea5de7496e'
4
- data.tar.gz: 2ba8dddffcd1aa85adcaf10ae2aa92583a7ab10b61eb6c09be6771b9947adb33
3
+ metadata.gz: 55842aa3173a34dd262ddd288264ca567e7f1952ff48b45173b995de12dddd9f
4
+ data.tar.gz: d08a821c86738f7f444bbf98ed9dc04bb2cdb915c03a6da46173b73d14929baa
5
5
  SHA512:
6
- metadata.gz: 7e4d2de2e5ea6b51a40788003ca8284a5c73a025ddcc12c5f4cecb59359809ed055423e119fa2f7e16651ecdd93936feeca3cc1552b1db9a800f9965d7e31508
7
- data.tar.gz: 0603fc03c1bbc826ddd80ec3f04d9cbf1d9a75ab065ce62e0485ad307add6146cf8ac9ef82430933aad3f02d02516343f6fb1cba33884fced9e447f98bf99b6a
6
+ metadata.gz: 70f569d41f4117778542b37cd4bb19012cee815b43e6997e011c73738ef68b038f6436595bc7eb0ad04b5a188b1ad51180ad6f1e9b2b9dae8612bbd9471c56e2
7
+ data.tar.gz: 38645753c1638a167ed83960b1f8a59bde245ef07c785378a990cc4cf4d1d2c08cb8f697aa561ae8800de544937bc67b847a7f0958c28234a558cfe87971c1c7
@@ -111,10 +111,15 @@ module PatchYAML
111
111
  key = parent.children[key_index]
112
112
  start_at = start_offset(value)
113
113
  end_at = end_offset(value)
114
+ end_at -= 1 if @data[end_at - 1] == "\n"
114
115
  yaml_value = dump_yaml(new_value, indent: key.start_column + 2)
115
- indent = if new_value.is_a?(Hash) || (new_value.is_a?(Array) && parent.style != Psych::Nodes::Mapping::FLOW)
116
+ indent = case
117
+ when new_value.is_a?(Hash)
116
118
  start_at -= 1 while @data[start_at - 1] == " "
117
119
  "\n#{" " * (key.start_column + 2)}"
120
+ when (new_value.is_a?(Array) && parent.style != Psych::Nodes::Mapping::FLOW)
121
+ start_at -= 1 while @data[start_at - 1] == " "
122
+ "#{" " * (key.start_column + 2)}"
118
123
  else
119
124
  ""
120
125
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Patchyaml
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patchyaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vito Sartori
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2025-10-27 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: YAML Editor Utility Library
13
13
  email:
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubygems_version: 3.6.7
54
+ rubygems_version: 3.6.2
55
55
  specification_version: 4
56
56
  summary: YAML Editor Utility Library
57
57
  test_files: []