Skip to content

Instantly share code, notes, and snippets.

@aaronbartell
Created February 7, 2014 22:00
Show Gist options
  • Save aaronbartell/8872852 to your computer and use it in GitHub Desktop.
Save aaronbartell/8872852 to your computer and use it in GitHub Desktop.
mixin test
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