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
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/html2rss/utils.rb', line 16
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
|
.hash_to_xml(hash) ⇒ Object
28
29
30
|
# File 'lib/html2rss/utils.rb', line 28
def self.hash_to_xml(hash)
hash.to_xml(root: :html, skip_instruct: true, skip_types: true)
end
|