Sha256: cc2631204853ecccd22f9a07e9523fe62fe199d30296cb22270c29a78a4d340a
Contents?: true
Size: 650 Bytes
Versions: 19
Compression:
Stored size: 650 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 =~ /^\s*$/ || line.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
19 entries across 19 versions & 1 rubygems