Skip to content

Instantly share code, notes, and snippets.

@Beyarz
Last active March 27, 2019 18:36
Show Gist options
  • Save Beyarz/7c4aba5d35cb47de7fcef3f3be405979 to your computer and use it in GitHub Desktop.
Save Beyarz/7c4aba5d35cb47de7fcef3f3be405979 to your computer and use it in GitHub Desktop.
A universal method to frame in strings.
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