class Module

  # Returns the name of module's container module.
  #
  #   module Example
  #     class Demo
  #     end
  #   end
  #
  #   Demo.name       #=> "Example::Demo"
  #   Demo.dirname    #=> "Example"
  #
  # See also Module#basename.
  #
  def dirname
    name.gsub(/::[^:]*$/, '')
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCModule < Test::Unit::TestCase

    def test_dirname
      assert_equal( 'Test::Unit', ::Test::Unit::TestCase.dirname )
    end

  end

=end

