Sha256: d1a38dd04dc4266ce39bb49660c2acab87d13ab8cb7ead0aa0641add48179cb5
Contents?: true
Size: 466 Bytes
Versions: 4
Compression:
Stored size: 466 Bytes
Contents
class String # Centers each newline of a string. # (This is probably how #center itself should work.) # # require 'facet/string/center_lines' # # s = <<-EOS # This is a test # and # so on # EOS # puts s.center_lines(14) # # _produces_ # # This is a test # and # so on # def center_lines(n) s = '' lines = self.split(/\n/) lines.each{ |line| s << line.center(n) << "\n" } s end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
facets-0.6.3 | lib/facet/string/center_lines.rb |
facets-0.7.0 | lib/facet/string/center_lines.rb |
facets-0.7.1 | lib/facet/string/center_lines.rb |
facets-0.7.2 | lib/facet/string/center_lines.rb |