Class: Shellout::Shadowbox

Inherits:
Object
  • Object
show all
Defined in:
lib/shellout/shadowbox.rb

Constant Summary collapse

MIN_WIDTH =
40

Instance Method Summary collapse

Constructor Details

#initialize(title) ⇒ Shadowbox

Returns a new instance of Shadowbox.



8
9
10
# File 'lib/shellout/shadowbox.rb', line 8

def initialize(title)
  @title = title
end

Instance Method Details



12
13
14
15
16
17
18
19
# File 'lib/shellout/shadowbox.rb', line 12

def print(out=$stdout)
  length = [@title.length, MIN_WIDTH].max + 2 
  out.print "" <<
  ''  << '' * length             <<  "┐ \n" <<
  '' << @title.center(MIN_WIDTH) << " │▒\n" <<
  ''  << '' * length             <<  "┘▒\n" <<
  '  ' << '' * length             <<   "▒\n"
end