Sha256: c21882e77cc079af029d18695117cb14a3daeea35cd5481fbc199e41db945289

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

module Microformats2
  module Property
    class Url < Foundation

      def to_s
        @to_s = absolutize(super.to_s)
      end

      # TODO: make dry, repeated in Collection
      def absolutize(href)
        uri = URI.parse(href)

        if @base && !uri.absolute?
          uri = URI.join(@base, href)
        end

        uri.normalize!
        uri.to_s
      end

      protected

      def attr_map
        @attr_map = {
          "a" => "href",
          "area" => "href",
          "img" => "src",
          "object" => "data",
          "abbr" => "title",
          "data" => "value" }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
microformats2-2.0.0 lib/microformats2/property/url.rb