Created
June 17, 2011 18:33
-
-
Save joshbuddy/1031992 to your computer and use it in GitHub Desktop.
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 Song | |
def initialize(title, length_in_seconds, author) | |
@title, @length_in_seconds, @author = title, length_in_seconds, author | |
end | |
# real ruby | |
def length_in_minutes | |
@length_in_seconds.to_f / 60 | |
end | |
def to_s | |
"#{@title} (#{@author})" | |
end | |
# fake ruby | |
def length_in_minutes = @length_in_seconds.to_f / 60 | |
def to_s = "#{@title} (#{@author})" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
isn't #define_method sort of like that?