lib/refinements/arrays.rb in refinements-7.1.0 vs lib/refinements/arrays.rb in refinements-7.2.0
- old
+ new
@@ -1,16 +1,19 @@
# frozen_string_literal: true
module Refinements
- # Refinements for arrays.
module Arrays
refine Array do
def compress
compact.reject(&:empty?)
end
def compress!
replace compress
+ end
+
+ def ring &block
+ [last, *self, first].each_cons 3, &block
end
end
end
end