Module: Html2rss::Utils
- Defined in:
- lib/html2rss/utils.rb
Defined Under Namespace
Classes: IndifferentAccessHash
Class Method Summary collapse
Class Method Details
.build_absolute_url_from_relative(url, channel_url) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/html2rss/utils.rb', line 12 def self.build_absolute_url_from_relative(url, channel_url) url = URI(url) if url.is_a?(String) return url if url.absolute? URI(channel_url).tap do |uri| uri.path = url.path.to_s.start_with?('/') ? url.path : "/#{url.path}" uri.query = url.query uri.fragment = url.fragment if url.fragment end end |