Skip to content

Commit

Permalink
Add ability to create ASCII box
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Oct 8, 2018
1 parent d4d631a commit 38dbcee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/tty/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Box
module_function

BOX_CHARS = {
ascii: %w[+ + + + + + + + - | +],
light: %w[ ],
thick: %w[ ]
}.freeze
Expand Down
16 changes: 15 additions & 1 deletion spec/unit/border_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
].join)
end

it "creates frame with double lines" do
it "creates frame with double lines and absolute position" do
box = TTY::Box.frame(
top: 0, left: 0,
width: 35, height: 4,
Expand All @@ -28,6 +28,20 @@
].join)
end

it "creates an ASCII box" do
box = TTY::Box.frame(
width: 10, height: 4,
border: :ascii
)

expect(box).to eq([
"+--------+\n",
"| |\n",
"| |\n",
"+--------+\n",
].join)
end

it "creates frame with without top & bottom borders" do
box = TTY::Box.frame(
top: 0, left: 0,
Expand Down

0 comments on commit 38dbcee

Please sign in to comment.