Created
November 12, 2013 03:17
-
-
Save damianesteban/7424902 to your computer and use it in GitHub Desktop.
Adaptation of 'Try Ruby'
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 BlogEntry | |
def initialize( title, mood, fulltext ) | |
@time = Time.now | |
@title, @mood, @fulltext = title, mood, fulltext | |
end | |
end | |
entry_one = BlogEntry.new("Yay Ruby!", :happy, "Ruby is the bomb.") | |
entry_two = BlogEntry.new("Yay Rails!", :confused, "Rails is the bomb.") | |
blog = [entry_one, entry_two] | |
blog.sort_by { |entry| entry.time }.reverse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment