Sha256: 646ca197c9ca177ce8ce59db4808c0a2c3ec2410ea6489ff77e8d730b0e089a7

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 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, directory: false)
      @uri = uri
      @directory = directory
    end

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

    ##
    # Does this RemoteEntry point to a directory
    def directory?
      @directory
    end

    ##
    # Does this RemoteEntry point to a symlink
    def symlink?
      false
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ro-crate-0.5.2 lib/ro_crate/model/remote_entry.rb
ro-crate-0.5.1 lib/ro_crate/model/remote_entry.rb