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 30 31 |
# File 'lib/super_p.rb', line 10 def super_p(*args) cols = `tput cols`.to_i puts 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 cols - text.size % cols end text + " " * padding end) puts " " * cols print "\e[0m" puts " " * cols args.size == 1 ? args[0] : args rescue print "\e[0m" end |