RouterSimple
RouterSimple is yet another HTTP routing library.
Installation
Add this line to your application's Gemfile:
gem 'router_simple'
And then execute:
$ bundle
Or install it yourself as:
$ gem install router_simple
Usage
router = RouterSimple::Router.new
router.register('GET', '/', 'Root')
router.register('POST', '/member/create', 'Member#create')
router.register('GET', '/member/:name', 'Member#detail')
router.register('GET', '/download/*path', 'Download#detail')
router.match('/')
# => ('Root', {})
router.match('/member/dankogai')
# => ('Member#detail', {"name" => 'dankogai'})
router.match('/download/growthforecast')
# => ('Download#detail', {"path" => 'growthforecast'})
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