Module: Absolution
- Extended by:
- Absolution
- Included in:
- Absolution
- Defined in:
- lib/absolution.rb,
lib/absolution/version.rb
Constant Summary collapse
- VERSION =
'0.0.5'
Instance Method Summary collapse
Instance Method Details
#absolute_url?(url) ⇒ Boolean
4 5 6 7 |
# File 'lib/absolution.rb', line 4 def absolute_url?(url) scheme = URI.parse(url.to_s).scheme !(scheme.nil? || scheme.empty?) end |
#construct_absolute_url(base_url, path) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/absolution.rb', line 9 def construct_absolute_url(base_url, path) uri = URI.parse(base_url) URI.parse(path.start_with?('/') ? path : "/#{path}").tap do |path_uri| uri.path = path_uri.path uri.query = path_uri.query uri.fragment = path_uri.fragment end uri.to_s end |