yalphabetize 0.4.0 → 0.4.1

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: 7233124faca7d704c5fc49708d03df7bf821863a7ef1470d2525b00dadc13c80
4
- data.tar.gz: 904ee4fb5f329b2b9be7fb33a1e7d4bebb3e15dddfee3b6928756e47aab4cf61
3
+ metadata.gz: 86d76847f2e23ff6fe3cd5a5e58304236f308cd0541a19bd3ab96f7db10bb601
4
+ data.tar.gz: 8c00fcc4c33db1396aeae8384d1fc62d12bb27dd5db2ef0e7115c6a1f4ccce09
5
5
  SHA512:
6
- metadata.gz: 1021062eedb1e2f0a7ceefd6fa7783f55079d415097476b94cea6c399223a8af5a0e8311d560e423744ad35292707280641c81c3c8ebc0ff97baad2b1ec3f9fd
7
- data.tar.gz: e633c877d5350bc007c0beb931c5eb7a322603b7cd0e4742c48ddc964b44d8da185cb444294c7d7e27e1ece707854948d94e9a534d03c5579eab770a1a6f97ef
6
+ metadata.gz: 6e83b56bf3dafb17675575d038cb07fd69c66d7732846eb5ade8379a84d6ac2994471784b2ba6bbdfa306bcbecddcc5d7f175f31c95fd7eaf1b5b509a4d0ba91
7
+ data.tar.gz: 37c7d42a08c8a1ac39bfc7bdfb4ce65ec9a658884bbc433df5504f636a9797ad1695bffca1847d7a651331b9929f72bf3a2253f258be03383319e67857af0039
@@ -27,10 +27,8 @@ module Yalphabetize
27
27
  def find_lines_to_indent
28
28
  @nodes_to_indent = []
29
29
 
30
- stream_node.each do |node|
31
- next if node.document?
32
-
33
- block_sequence_nodes(node)&.each do |sequence_node|
30
+ stream_node.select(&:mapping?).each do |mapping_node|
31
+ block_sequence_nodes(mapping_node)&.each do |sequence_node|
34
32
  @nodes_to_indent.push(*sequence_node.children)
35
33
  end
36
34
  end
@@ -46,7 +44,9 @@ module Yalphabetize
46
44
 
47
45
  def indent!
48
46
  @nodes_to_indent.each do |node|
49
- file_lines[node.start_line..node.end_line].each do |line|
47
+ node_end_line = node.start_line == node.end_line ? node.end_line : node.end_line - 1
48
+
49
+ file_lines[node.start_line..node_end_line].each do |line|
50
50
  line.gsub!(line, " #{line}")
51
51
  end
52
52
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yalphabetize
4
4
  class Version
5
- STRING = '0.4.0'
5
+ STRING = '0.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yalphabetize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Jenkins