[2022][ruby][4.x] cleanup
diff --git a/2022/ruby/day_04.rb b/2022/ruby/day_04.rb
index 53138c2..b57810e 100644
--- a/2022/ruby/day_04.rb
+++ b/2022/ruby/day_04.rb
@@ -1,6 +1,6 @@
-p ARGF.read.lines(chomp: true)
- .map { _1.split(?,) }
- .map {|x| x.map { _1.split(?-).map(&:to_i) }}
- .map {|(a,b),(x,y)| [(a..b), (x..y)] }
- # .count {|a,b| (a.cover?(b.begin) && a.cover?(b.end)) || (b.cover?(a.begin) && b.cover?(a.end)) }
- .count {|a,b| (a.cover?(b.begin) || a.cover?(b.end)) || (b.cover?(a.begin) || b.cover?(a.end)) }
+p ARGF.read
+ .scan(/(\d+)-(\d+),(\d+)-(\d+)/)
+ .map { _1.map(&:to_i) }
+ .map {|a,b,c,d| [(a..b), (c..d)] }
+ # .count {|a,b| a.cover?(b) || b.cover?(a) } # part 1
+ .count {|a,b| a.minmax.any? { b.cover?(_1) } || b.minmax.any? { a.cover?(_1) }}