Created
April 3, 2012 20:08
-
-
Save zakgrant/2295190 to your computer and use it in GitHub Desktop.
Example of chaining module instance methods
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
#! /usr/bin/env ruby | |
module A | |
def say_hello name | |
puts "Hello #{name}" | |
end | |
end | |
class B | |
include A | |
def say_hello name | |
super | |
end | |
end | |
b = B.new | |
b.say_hello "GitHub" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment