Sha256: 91ecbec5ae0d3ef18b51144421e80792fe5050de59ee98d722d622f081b3133a
Contents?: true
Size: 637 Bytes
Versions: 1
Compression:
Stored size: 637 Bytes
Contents
module Snibbets class ::Array def blocks select { |el| el =~ /^<block\d+>$/ }.count end def strip_empty remove_leading_empty_elements.remove_trailing_empty_elements end def strip_empty! replace strip_empty end def remove_leading_empty_elements output = [] in_leader = true each do |line| if (line.strip.empty?) && in_leader next else in_leader = false output << line end end output end def remove_trailing_empty_elements reverse.remove_leading_empty_elements.reverse end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snibbets-2.0.30 | lib/snibbets/array.rb |