Created
March 24, 2014 13:31
-
-
Save makaroni4/9740109 to your computer and use it in GitHub Desktop.
Ruby Quiz questions
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
# Reddit thread: http://www.reddit.com/r/ruby/comments/217yvm/trivia_ruby_quiz/ | |
# Quiz page: http://makaroni4.com/ruby/quiz/2014/03/24/ruby-quiz/ | |
# Explanation link: http://www.medihack.org/2011/03/15/intend-to-extend/ | |
# Code example: | |
module Human | |
def eat | |
puts "Yam" | |
end | |
end | |
class Robocop | |
def shoot | |
end | |
end | |
class User | |
extend Human | |
end | |
User.eat # => Yam | |
class User | |
extend Human | |
extend Robocop | |
end | |
# => wrong argument type Class (expected Module) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment