Method: ClassBrowser#pretty_print
- Defined in:
- lib/ClassBrowser.rb
#pretty_print(prefix, methods, suffix = "") ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ClassBrowser.rb', line 23 def pretty_print prefix, methods, suffix = "" methods.sort_by { |m| m.to_s } width = ENV['COLUMNS'].to_i col = 0 methods.each do |m| msg = '%-24.24s' % "#{prefix}#{m.to_s}#{suffix}" col += msg.length if col >= width print "\n" col = msg.length end print msg end print "\n" end |