Sha256: d582c43b917e9a99afb4c056f9f4b1f637982c268431cef166bc208210eaeed8
Contents?: true
Size: 868 Bytes
Versions: 3
Compression:
Stored size: 868 Bytes
Contents
require 'active_support/core_ext/hash' require 'builder' require 'hashie' require 'json' require 'nokogiri' module Html2rss module Utils ## # A Hash with indifferent access, build with {https://github.com/intridea/hashie Hashie}. class IndifferentAccessHash < Hash include Hashie::Extensions::MergeInitializer include Hashie::Extensions::IndifferentAccess end 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 def self.hash_to_xml(hash) hash.to_xml(root: :html, skip_instruct: true, skip_types: true) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
html2rss-0.5.2 | lib/html2rss/utils.rb |
html2rss-0.5.1 | lib/html2rss/utils.rb |
html2rss-0.5.0 | lib/html2rss/utils.rb |