Sha256: 5cb7e4aeff4d46c893a4120613d28016e857571bd85cd2d47336f7a1c3778c1a

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

module ROCrate
  ##
  # A class to represent a reference within an RO-Crate, to a remote file held on the internet somewhere.
  # It handles the actual reading/writing of bytes.
  class RemoteEntry < Entry
    attr_reader :uri

    ##
    # Create a new RemoteEntry.
    #
    # @param uri [URI] An absolute URI.
    def initialize(uri)
      @uri = uri
    end

    ##
    # @return [IO] An IO object for the remote resource.
    #
    def source
      open(uri)
    end

    ##
    # Does this RemoteEntry point to a directory on the disk?
    def directory?
      false
    end

    ##
    # Does this RemoteEntry point to a remote resource?
    def remote?
      true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ro-crate-0.4.14 lib/ro_crate/model/remote_entry.rb
ro-crate-0.4.13 lib/ro_crate/model/remote_entry.rb
ro-crate-0.4.12 lib/ro_crate/model/remote_entry.rb