Crayon::Box
Inherits Reference < Object
Constants
STYLES = [{:bottom_left => "", :bottom_right => "", :horizontal => "", :top_left => "", :top_right => "", :vertical => ""}, {:bottom_left => '└', :bottom_right => '┘', :horizontal => '─', :top_left => '┌', :top_right => '┐', :vertical => '│'}, {:bottom_left => '╚', :bottom_right => '╝', :horizontal => '═', :top_left => '╔', :top_right => '╗', :vertical => '║'}, {:bottom_left => '╰', :bottom_right => '╯', :horizontal => '─', :top_left => '╭', :top_right => '╮', :vertical => '│'}, {:bottom_left => '╙', :bottom_right => '╜', :horizontal => '─', :top_left => '╓', :top_right => '╖', :vertical => '║'}, {:bottom_left => '╘', :bottom_right => '╛', :horizontal => '═', :top_left => '╒', :top_right => '╕', :vertical => '│'}, {:bottom_left => '+', :bottom_right => '+', :horizontal => '-', :top_left => '+', :top_right => '+', :vertical => '|'}]
Constructors
new(content : String | Array(String))
Create the box
box = Crayon::Box.new("Rainbows!")
puts box.render
# ┌─────────┐
# │Rainbows!│
# └─────────┘
Instance methods
set_margin(x : Int32, y : Int32) : self
Set the external margin of the box
x is the number of empty lines above and below y is the number of spaces to the left and right
set_padding(x : Int32, y : Int32) : self
Set the internal padding of the box
x is the number of empty lines above and below y is the number of spaces to the left and right
set_title(title : String) : self
Set the title of the box
box = Crayon::Box.new("I believe in unicorns!")
box.set_title("Title")
puts box.render
# ┌ Title ───────────────┐
# │I believe in unicorns!│
# └──────────────────────┘