Modularize
Dynamically create Ruby module hierarchies
Modulize.create('Animals::Cats::Bombay')
is the equivelent to:
module Animals
module Cats
module Bombay
end
end
end
But Why?
In RestPack, I want to create some modules at load time so that I don't need to nest class definitions in module namespaces. I want to be able to do this:
module Commands::Groups::Invitation
class Create
..
end
end
instead of this:
module Commands
module Groups
module Invitation
class Create
..
end
end
end
end
Watch a video of the gem creation: http://www.youtube.com/watch?v=JR3tlXae73k
Installation
Add this line to your application's Gemfile:
gem 'modularize'
And then execute:
$ bundle
Or install it yourself as:
$ gem install modularize
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request