Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created October 5, 2011 01:16
Show Gist options
  • Select an option

  • Save ConradIrwin/1263364 to your computer and use it in GitHub Desktop.

Select an option

Save ConradIrwin/1263364 to your computer and use it in GitHub Desktop.
module LS
class Top; def self.foo; puts "Top"; end end
class Next < Top; def self.foo; puts "Next"; super; end end
module M; def foo; puts "M"; super; end end
module N; include M; def foo; puts "N"; super; end end
module O; include M; def foo; puts "O"; super; end end
module P; def foo; puts "P"; super; end end
class Low < Next; include N; include P; def self.foo; puts "Low"; super; end end
class Lower < Low; def self.foo; puts "Lower"; super; end end
class Bottom < Lower; extend M; def self.foo; puts "Bottom"; super; end end
Lower.extend N
end
LS::Bottom.foo
puts (class << LS::Bottom; ancestors.inspect; end)
puts LS::Bottom.ancestors.inspect
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment