module AsciiParadise::Unicode
Public Class Methods
draw_double_border_box( width = 20, height = 20, left_padding_to_use = ' ' )
click to toggle source
#¶ ↑
AsciiParadise::Unicode.draw_double_border_box
¶ ↑
This method can be used to draw a double-border box.
#¶ ↑
# File lib/ascii_paradise/unicode/double_border.rb, line 36 def self.draw_double_border_box( width = 20, height = 20, left_padding_to_use = ' ' ) if width.is_a?(Array) and width.empty? width = 20 end height.times {|position| case position when 0 token = UNICODE_DOUBLE_BORDER_TOP_LEFT else if (position+1 == height) token = UNICODE_DOUBLE_BORDER_BOTTOM_LEFT else token = UNICODE_DOUBLE_BORDER_VERTICAL end end print left_padding_to_use ee token calculated_width = width * 2 calculated_width.times {|width_position| case position when 0 print UNICODE_DOUBLE_BORDER_HORIZONTAL else if (position+1 == height) print UNICODE_DOUBLE_BORDER_HORIZONTAL else print ' ' end end if (width_position+1 == calculated_width) if position == 0 print UNICODE_DOUBLE_BORDER_TOP_RIGHT elsif position == (calculated_width/2-1) print UNICODE_DOUBLE_BORDER_BOTTOM_RIGHT else print UNICODE_DOUBLE_BORDER_VERTICAL end end } e } end
e(i = '')
click to toggle source