# File lib/text/format.rb, line 728 728: def center(to_center = nil) 729: to_center = @text if to_center.nil? 730: to_center = [to_center].flatten 731: 732: tabs = 0 733: width = @columns - @left_margin - @right_margin 734: centered = [] 735: to_center.each do |tc| 736: s = tc.strip 737: tabs = s.count(TAB) 738: tabs = 0 if tabs.nil? 739: ct = ((width - s.size - (tabs * @tabstop) + tabs) / 2) 740: ct = (width - @left_margin - @right_margin) - ct 741: centered << "#{s.rjust(ct)}\n" 742: end 743: centered.join('') 744: end