Skip to content

Commit 5fb593f

Browse files
committed
fix "undefined method `=~' for false:FalseClass" on Ruby >= 3.2
see https://bugs.ruby-lang.org/issues/15231
1 parent 665f915 commit 5fb593f

File tree

2 files changed

+4
-2
lines changed
  • lib/octocatalog-diff/catalog-diff/display
  • spec/octocatalog-diff/tests/catalog-diff/display

2 files changed

+4
-2
lines changed

lib/octocatalog-diff/catalog-diff/display/text.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,13 @@ def self.addition_only_no_truncation(depth, hash)
367367

368368
# Single line strings
369369
hash.keys.sort.map do |key|
370-
next if hash[key] =~ /\n/
370+
next if hash[key].kind_of?(String) && hash[key] =~ /\n/
371371
result << left_pad(2 * depth + 4, [key.inspect, ': ', hash[key].inspect].join('')).green
372372
end
373373

374374
# Multi-line strings
375375
hash.keys.sort.map do |key|
376+
next if !hash[key].kind_of?(String)
376377
next if hash[key] !~ /\n/
377378
result << left_pad(2 * depth + 4, [key.inspect, ': >>>'].join('')).green
378379
result.concat hash[key].split(/\n/).map(&:green)

spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@
254254
'mode' => '0644',
255255
'content' => 'x' * 150,
256256
'owner' => 'root',
257-
'group' => 'wheel'
257+
'group' => 'wheel',
258+
'force' => true,
258259
}
259260
}
260261
]

0 commit comments

Comments
 (0)