Sha256: 96641f14b88e8f87b5318a44f8b4aac1a7003f7d3206a2e323774ceea4000d26

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

require 'hashie'

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?

      path, query = url.to_s.split('?')

      URI(channel_url).tap do |uri|
        uri.path = path.to_s.start_with?('/') ? path : "/#{path}"
        uri.query = query
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
html2rss-0.4.0 lib/html2rss/utils.rb