Module: Absolution
- Extended by:
- Absolution
- Included in:
- Absolution
- Defined in:
- lib/absolution.rb,
lib/absolution/version.rb
Constant Summary collapse
- VERSION =
'0.0.4'
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 |
# File 'lib/absolution.rb', line 9 def construct_absolute_url(base_url, path) u = URI.parse(base_url) path.split('?').tap do |path_array| u.path = path_array.first.start_with?('/') ? path_array.first : "/#{path_array.first}" u.query = path_array.last if path_array.length > 1 end u.to_s end |