class Roma::Mkconfig::Box
Public Class Methods
print_edge(width)
click to toggle source
# File lib/roma/tools/mkconfig.rb 240 def self.print_edge(width) 241 print "+" 242 width.times { print "-" } 243 print "+\n" 244 end
print_with_box(arg)
click to toggle source
# File lib/roma/tools/mkconfig.rb 246 def self.print_with_box(arg) 247 return if arg.count == 0 248 249 if arg.class == Hash 250 strs = Array.new 251 arg.each do |k, v| 252 strs << "#{k}: #{arg[k]}" 253 end 254 arg = strs 255 end 256 257 width = max_length(arg) + 1 258 print_edge(width) 259 260 arg.each do |s| 261 print "|#{s}" 262 (width - s.length).times do 263 print " " 264 end 265 print "|\n" 266 end 267 268 print_edge(width) 269 end
Private Class Methods
max_length(arg)
click to toggle source
# File lib/roma/tools/mkconfig.rb 273 def self.max_length(arg) 274 max = 0 275 arg.each do |s| 276 max = s.length if s.length > max 277 end 278 max 279 end