Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/namusyaka/modulla
Enables DSL on your module
https://github.com/namusyaka/modulla
Last synced: about 1 month ago
JSON representation
Enables DSL on your module
- Host: GitHub
- URL: https://github.com/namusyaka/modulla
- Owner: namusyaka
- License: mit
- Created: 2016-11-07T13:50:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-14T16:07:32.000Z (about 8 years ago)
- Last Synced: 2024-04-27T11:44:56.315Z (7 months ago)
- Language: Ruby
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Modulla
Modulla is a super simple gem to enable DSL on your module.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'modulla'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install modulla
## Usage
```ruby
module DSL
extend Modullafoo { 'foo' }
bar { 'bar' }
baz { 'baz' }plus(1, 1)
endclass Sample
def self.foo(&block)
puts block.call * 1
enddef self.bar(&block)
puts block.call * 2
enddef self.baz(&block)
puts block.call * 3
enddef self.plus(a, b)
puts a + b
end
endclass Sample
include DSL #=> Output: 'foo', 'barbar', 'bazbazbaz', 2
end
```You can use modulla for use shared_examples in test-unit like this.
```ruby
module SharedExamplesForFoo
extend Modullasub_test_case 'foo' do
test 'yay' do
assert { ... }
end
end
endclass Testing < Test::Unit::TestCase
include SharedExamplesForFoo
end
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/namusyaka/modulla.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).