inspired by "slug" from npm, but optimized for my slugs use case. Requests for more slug examples are welcome!
-
Add the dependency to your
shard.yml
:dependencies: webslug: github: iomcr/webslug
-
Run
shards install
require "webslug"
Iom::WebSlug.slug("i ♥ unicode").should eq "i-love-unicode"
Iom::WebSlug.slug("I ♥ UNICODE").should eq "i-love-unicode"
Iom::WebSlug.slug("i <3 unicode").should eq "i-love-unicode"
Iom::WebSlug.slug("компютъра").should eq "kompyutura"
Iom::WebSlug.slug("unicode ♥ is ☢").should eq "unicode-love-is-radioactive"
Iom::WebSlug.slug("http://www.example.com").should eq "www-example-com"
Iom::WebSlug.slug("Schlotsky's").should eq "schlotskys"
TODO: Write development instructions here
- Fork it (https://github.com/iomcr/webslug/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
- Iomcr - creator and maintainer