include
Includes constants, classes, methods and submodules from a module into the current scope.
module TestModule
CONSTANT = 1
class TClass
end
end
include_module(TestModule)
TClass # => TestModule::TClass
CONSTANT # => TestModule::CONSTANT
Installation
-
Add the dependency to your
shard.yml
:dependencies: include: github: tkshnwesper/include
-
Run
shards install
Usage
require "include"
module TestModule
extend self
def test_function
end
CONSTANT = 1
class TClass
end
module SubModule
end
end
include_module(TestModule)
test_function # => TestModule.test_function
SubModule # => TestModule::SubModule
Including methods
You can only include methods if the module
extends itself. See this for more details.
Contributing
- Fork it (https://github.com/tkshnwesper/include/fork)
- 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 a new Pull Request
Contributors
- tkshnwesper - creator and maintainer