Class: ROCrate::RemoteEntry
- Inherits:
-
Object
- Object
- ROCrate::RemoteEntry
- Defined in:
- lib/ro_crate/model/remote_entry.rb
Overview
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.
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#directory? ⇒ Boolean
Does this RemoteEntry point to a directory on the disk?.
-
#initialize(uri) ⇒ RemoteEntry
constructor
Create a new RemoteEntry.
-
#read ⇒ Object
Read from the source.
-
#remote? ⇒ Boolean
Does this RemoteEntry point to a remote resource?.
-
#source ⇒ IO
An IO object for the remote resource.
- #write(dest) ⇒ Object
Constructor Details
#initialize(uri) ⇒ RemoteEntry
Create a new RemoteEntry.
12 13 14 |
# File 'lib/ro_crate/model/remote_entry.rb', line 12 def initialize(uri) @uri = uri end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/ro_crate/model/remote_entry.rb', line 6 def uri @uri end |
Instance Method Details
#directory? ⇒ Boolean
Does this RemoteEntry point to a directory on the disk?
36 37 38 |
# File 'lib/ro_crate/model/remote_entry.rb', line 36 def directory? false end |
#read ⇒ Object
Read from the source.
23 24 25 |
# File 'lib/ro_crate/model/remote_entry.rb', line 23 def read source.read end |
#remote? ⇒ Boolean
Does this RemoteEntry point to a remote resource?
42 43 44 |
# File 'lib/ro_crate/model/remote_entry.rb', line 42 def remote? true end |
#source ⇒ IO
Returns An IO object for the remote resource.
30 31 32 |
# File 'lib/ro_crate/model/remote_entry.rb', line 30 def source open(uri) end |
#write(dest) ⇒ Object
16 17 18 |
# File 'lib/ro_crate/model/remote_entry.rb', line 16 def write(dest) raise 'Cannot write to a remote entry!' end |