Created
February 7, 2014 22:00
-
-
Save aaronbartell/8872852 to your computer and use it in GitHub Desktop.
mixin test
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
module Foo | |
def a1 | |
puts "a1: I am a #{self.class.name}" | |
end | |
def Foo.a2 | |
puts "a2: I am a #{self.class.name}" | |
end | |
def self.a3 | |
puts "a3: I am a #{self.class.name}" | |
end | |
end | |
class Bar | |
include Foo # Foo gets "mixed in" | |
def run | |
a1 | |
Foo.a2 | |
Foo.a3 | |
end | |
end | |
Bar.new.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment