Project

namespaces

0.0
No release in over 3 years
Low commit activity in last 3 years
Get lexical context of self as array of modules
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

INSTALL

gem install namespaces

EXAMPLE

require 'rubygems'
require 'shoulda'
require 'namespaces'

module A
  module B
    module C
      class X
        include Namespaces
        extend Namespaces
      end
    end
  end
end

class ModulesTest < Test::Unit::TestCase
  should "return modules array when called as class method" do
    assert_equal [A::B::C, A::B, A], A::B::C::X.namespaces
  end

  should "return modules array when called as instance method" do
    assert_equal [A::B::C, A::B, A], A::B::C::X.new.namespaces
  end
end

WHY ON EARTH SOMEBODY MIGHT NEED IT?

I have described it here

License

MIT.