Skip to content

Instantly share code, notes, and snippets.

@robbiemu
Created November 14, 2011 16:24
Show Gist options
  • Save robbiemu/1364348 to your computer and use it in GitHub Desktop.
Save robbiemu/1364348 to your computer and use it in GitHub Desktop.
module A
@a_ins_var
def a
puts @a_ins_var
end
def a=(v)
@a_ins_var=v
end
end
module B
include A
@b_ins_var
def b
puts @b_ins_var
end
def b=(v)
@b_ins_var=v
end
end
module C
include B
@c_ins_var
def c
puts @c_ins_var
end
def c=(v)
@c_ins_var=v
end
end
class Foo
include C
end
f=Foo.new
f.a="foo"
f.b="bar"
f.c="baz"
f.a
=> foo
f.b
=> bar
f.c
=> baz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment