0.0
The project is in a healthy, maintained state
Generate short URLs with customizable domains using Base62 encoding
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.0
 Project Readme

UrlShortly

A simple Ruby gem for generating short URLs using Base62 encoding.

Installation

Add this line to your application's Gemfile:

gem 'url_shortly'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install url_shortly

Usage

Generate short URLs using short.ly domain:

require 'url_shortly'

UrlShortly.shorten('https://really-long-url.com/with/lots/of/parameters')
# => "http://short.ly/bK92m"

# Invalid URLs will raise an error
UrlShortly.shorten('not-a-valid-url')
# => raises Shortly::Error, "Invalid URL format"

UrlShortly.shorten('')
# => raises UrlShortly::Error, "URL cannot be empty"

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Inzmam/shortly.

License

The gem is available as open source under the terms of the MIT License.