Sha256: 2b3f8dbaa25650a64984ea6355c54335190c118a95e2ccbe7294bd0ed13e806b
Contents?: true
Size: 688 Bytes
Versions: 26
Compression:
Stored size: 688 Bytes
Contents
#-- # Special thanks to Mauricio Fernandez # parent = Object.const_get(mod.to_s.sub(/::[^:]+\z/, "")) #++ class Module def nesting n = [] name.split(/::/).inject(self){ |mod, name| c = mod.const_get(name) ; n << c ; c } return n end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCModule < Test::Unit::TestCase module M module N class C def n self.class.nesting end end end end def test_nesting assert_equal( [TCModule, M, M::N, M::N::C], M::N::C.new.n ) end end =end
Version data entries
26 entries across 26 versions & 1 rubygems