Module: Kernel
- Defined in:
- lib/super_p.rb
Instance Method Summary collapse
- #super_p(*args) ⇒ Object (also: #sp)
Instance Method Details
#super_p(*args) ⇒ Object Also known as: sp
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/super_p.rb', line 10 def super_p(*args) begin cols = `tput cols`.to_i print SuperP.color || "\e[45;35m" puts " " * cols puts *(args.map do |i| text = i.inspect padding = if text.size < cols cols - text.size else text.size % cols end text + " " * padding end) puts " " * cols ensure print "\e[0m" end args.size == 1 ? args[0] : args end |