Project

absolution

0.0
No commit activity in last 3 years
No release in over 3 years
Absolute URL detection and construction
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

Absolution

Want to know if a string is an absolute URL? Heck, want to construct an absolute URL from a base URL and a path? This is your lucky day!

There's not much to this thing, and what's there exists only to serve the needs that I've had for this sort of thing.

That said, pull requests are totally welcome :)

Gem Setup

gem install absolution

# Gemfile
gem 'absolution'

Basic usage (class methods)

require 'absolution'

Absolution.absolute_url?('blah')
  => false
Absolution.absolute_url?('/blah')
  => false
Absolution.absolute_url?('http://blah')
  => true

Absolution.construct_absolute_url('https://base.url', 'blah')
  => 'https://base.url/blah'

Absolution.construct_absolue_url('http://base.url/path/to/namespace', 'blah')
  => 'http://base.url/path/to/namespace/blah'

Other usage (mixin)

Want a class to know how to do this stuff on its own?

require 'absolution'

class SomeClass
  include Absolution

  def absolute_url_to(somefile)
    return somefile if absolute_url?(somefile)
    construct_absolute_url('http://base.url', somefile)
  end
end

Contributing

Do you use git-flow? I sure do. Please base anything you do off of the develop branch.

  1. Fork it.
  2. Perform some BDD magic. Seriously. Be testing.
  3. Submit a pull request.

History

  • 0.0.6 - Handle path in base URL
  • 0.0.5 - Better relative path handling
  • 0.0.4 - Query strings are handled properly
  • 0.0.2 - Initial release

License

MIT License. Copyright 2014 Dennis Walters