Sha256: ceec877d49785c688e7c559ebe0a96c2da680243038f12f6216df4cdf82adbb0
Contents?: true
Size: 264 Bytes
Versions: 3
Compression:
Stored size: 264 Bytes
Contents
class String # Indent left or right by n spaces. # (This used to be called #tab and aliased as #indent.) # # require 'facet/string/tab' # def indent(n) if n >= 0 gsub(/^/, ' ' * n) else gsub(/^ {0,#{-n}}/, "") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-0.7.0 | lib/facet/string/indent.rb |
facets-0.7.1 | lib/facet/string/indent.rb |
facets-0.7.2 | lib/facet/string/indent.rb |