Module: AsciiParadise::Unicode

Defined in:
lib/ascii_paradise/unicode/double_border.rb

Class Method Summary collapse

Class Method Details

.draw_double_border_box(width = 20, height = 20, left_padding_to_use = ' ') ⇒ Object

#

AsciiParadise::Unicode.draw_double_border_box

This method can be used to draw a double-border box.

#


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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 = '') ⇒ Object

#

AsciiParadise::Unicode.e

#


26
27
28
# File 'lib/ascii_paradise/unicode/double_border.rb', line 26

def self.e(i = '')
  ::AsciiParadise.e(i)
end

.ee(i = '') ⇒ Object

#

AsciiParadise::Unicode.ee

#


19
20
21
# File 'lib/ascii_paradise/unicode/double_border.rb', line 19

def self.ee(i = '')
  print i
end