url_regexp
Installation
Add the url_regexp gem to your Gemfile.
gem "url_regexp"
And run bundle install
.
Usage
e.g.
root = UrlRegexp::Root.new
root.append('http://www.example.com/foo/bar')
root.to_regexp
# => /^http:\/\/www\.example\.com\/foo\/bar([?#]|$)/
root.append('http://www.example.com/foo/bar/wow')
root.to_regexp
# => /^http:\/\/www\.example\.com\/foo\/bar(\/wow)?([?#]|$)/
root.append('http://www.example.com/boo/bar')
root.to_regexp
# => /^http:\/\/www\.example\.com\/(foo\/bar(\/wow)?|boo\/bar)([?#]|$)/
root.append('http://www.example.com/boo/bar/wow')
root.to_regexp
# => /^http:\/\/www\.example\.com\/(foo|boo)\/bar(\/wow)?([?#]|$)/
You can set the options globally and locally. Locally set option overwrites the one globally set. Just add any settings necessary for your mailers from the list below.
Test
bundle exec rake
It will execute rspec
and rubocop
.
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
Copyright
Copyright (c) 2016 Daisuke Taniwaki. See LICENSE for details.