center text using spaces on left side to pad it out empty lines are preserved
Source Code
# File action_mailer/vendor/text-format-0.6.3/text/format.rb, line 682 def __center(to_center) #:nodoc: tabs = 0 width = @columns - @left_margin - @right_margin centered = [] to_center.each do |tc| s = tc.strip tabs = s.count("\t") tabs = 0 if tabs.nil? ct = ((width - s.size - (tabs * @tabstop) + tabs) / 2) ct = (width - @left_margin - @right_margin) - ct centered << "#{s.rjust(ct)}\n" end centered.join('') end
<code/>and<pre/>for code samples.