Skip to content

Instantly share code, notes, and snippets.

@alebaffa
Created March 11, 2014 20:34
Show Gist options
  • Save alebaffa/9494409 to your computer and use it in GitHub Desktop.
Save alebaffa/9494409 to your computer and use it in GitHub Desktop.
Week 5 exercise 2.
class Shape
def initialize name
@name = name
end
def rotate(rotation_type)
"#{@name} is rotating around #{rotation_type}"
end
def play_sound(format)
"#{@name} is playing file #{@name}.#{format}"
end
def click(rotation_type = 'the center', format = 'aif')
puts rotate(rotation_type)
puts play_sound(format)
end
end
Shape.new("Square").click
Shape.new("Triangle").click
Shape.new("Circle").click
Shape.new("Amoeba").click('a end point', 'hif')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment