Created
March 11, 2014 20:34
-
-
Save alebaffa/9494409 to your computer and use it in GitHub Desktop.
Week 5 exercise 2.
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 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