class ROCrate::RemoteEntry

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.

Attributes

uri[R]

Public Class Methods

new(uri) click to toggle source

Create a new RemoteEntry.

@param uri [URI] An absolute URI.

# File lib/ro_crate/model/remote_entry.rb, line 12
def initialize(uri)
  @uri = uri
end

Public Instance Methods

directory?() click to toggle source

Does this RemoteEntry point to a directory on the disk?

# File lib/ro_crate/model/remote_entry.rb, line 36
def directory?
  false
end
read() click to toggle source

Read from the source.

# File lib/ro_crate/model/remote_entry.rb, line 23
def read
  source.read
end
remote?() click to toggle source

Does this RemoteEntry point to a remote resource?

# File lib/ro_crate/model/remote_entry.rb, line 42
def remote?
  true
end
source() click to toggle source

@return [IO] An IO object for the remote resource.

# File lib/ro_crate/model/remote_entry.rb, line 30
def source
  open(uri)
end
write(dest) click to toggle source
# File lib/ro_crate/model/remote_entry.rb, line 16
def write(dest)
  raise 'Cannot write to a remote entry!'
end