On Github skilowg / RefactorsPresentation
class Rectangle
def initialize(width, height)
@width = width
@height = height
end
def area
@width * @height
end
def perimeter
2 * (@width + @height)
end
end
r = Rectangle.new(23.45, 34.67)
puts "Area is = #{r.area}"
puts "Perimeter is = #{r.perimeter}"
view raw
that is some ugly a** code...
Our users want a better way to ask help refactoring their code and help others refactor their code so that we can make the world a better place.
Refactors is a community of like-minded coders seeking to improve their code together. Post code to be refactored or browse code to refactor and help each other.