Created
July 2, 2010 11:03
Revisions
-
ncr revised this gist
Jul 2, 2010 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,13 +10,13 @@ => "y" irb(main):007:0> Class.new do include B; include A end.new.x => "x" irb(main):008:0> A.send :include, B # Look at this line. => A irb(main):009:0> Class.new do include A; end.new.x => "x" irb(main):010:0> Class.new do include B; end.new.x => "y" irb(main):011:0> Class.new do include A; include B end.new.x # I can't find explanation for this... => "x" irb(main):012:0> Class.new do include B; include A end.new.x => "x" -
ncr created this gist
Jul 2, 2010 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ irb(main):002:0> module A; def x; "x"; end end => nil irb(main):003:0> module B; def x; "y"; end end => nil irb(main):004:0> Class.new do include A; end.new.x => "x" irb(main):005:0> Class.new do include B; end.new.x => "y" irb(main):006:0> Class.new do include A; include B end.new.x => "y" irb(main):007:0> Class.new do include B; include A end.new.x => "x" irb(main):008:0> A.send :include, B => A irb(main):009:0> Class.new do include A; end.new.x => "x" irb(main):010:0> Class.new do include B; end.new.x => "y" irb(main):011:0> Class.new do include A; include B end.new.x => "x" irb(main):012:0> Class.new do include B; include A end.new.x => "x"