Skip to content

Instantly share code, notes, and snippets.

@sferik sferik/square.rb
Last active Dec 18, 2015

Embed
What would you like to do?
class Square < Rectangle
def initialize(side)
@side = side
end
def height
@side
end
def width
@side
end
def area
@side ** 2
end
def to_s
puts " " + ("_" * (@side * 2))
@side.times do
puts "|" + (" " * @side * 2) + "|"
end
puts " " + ("-" * (@side * 2))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.