Last active
March 27, 2019 18:36
-
-
Save Beyarz/7c4aba5d35cb47de7fcef3f3be405979 to your computer and use it in GitHub Desktop.
A universal method to frame in strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Frame | |
def Frame::this(input) | |
len = input.length | |
puts "-"*(len+2) | |
puts "|"+input+"|" | |
puts "-"*(len+2) | |
end | |
def Frame::side(input) | |
puts "|"+input+"|" | |
end | |
def Frame::top(input) | |
len = input.length | |
puts "-"*(len) | |
puts input | |
puts "-"*(len) | |
end | |
end | |
Frame.this("Hello world") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment