Sha256: 4ce440cfd6a3094d4f07394511307c3b7a4cac497c7ec1365357e75e1a8b1faf

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

module Subjoin
  # A link object
  class Link
    include Metable

    # The URL for this link
    # @return String
    attr_reader :href

    def initialize(data)
      if data.is_a? String
        @href = URI(data)
      else
        @href = URI(data['href'])
        @meta = load_meta(data['meta'])
      end
    end

    # Returns the {#href} attribute
    def to_s
      @href.to_s
    end

    # Get the resource identified by the URL
    # @return [Document]
    def get
      Document.new(@href)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
subjoin-0.2.1 lib/subjoin/link.rb