Sha256: 26620fd6a3efdaf4bf5242e5b315e215ed89ea5f7627842f00c322d48ebb053a
Contents?: true
Size: 632 Bytes
Versions: 37
Compression:
Stored size: 632 Bytes
Contents
module Fontist module Import module TextHelper class << self def cleanup(text) return unless text text.gsub("\r\n", "\n") .gsub("\r", "\n") .strip .lines .map(&:rstrip) .drop_while(&:empty?) .join("\n") end def longest_common_prefix(strs) return if strs.empty? min, max = strs.minmax idx = min.size.times { |i| break i if min[i] != max[i] } prefix = min[0...idx].strip return if prefix.empty? prefix end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems