Class: IOStreams::S3::Path
Instance Attribute Summary
Attributes inherited from BasePath
#path
Instance Method Summary
collapse
Methods inherited from BasePath
#join, #reader, #to_s, #writer
Constructor Details
#initialize(path) ⇒ Path
Returns a new instance of Path.
5
6
7
8
9
10
11
|
# File 'lib/io_streams/s3/path.rb', line 5
def initialize(path)
IOStreams::S3.load_dependencies
@s3 = Aws::S3::Resource.new
@options = IOStreams::S3.parse_uri(path)
@object = s3.bucket(options[:bucket]).object(options[:key])
super(path)
end
|
Instance Method Details
#delete ⇒ Object
30
31
32
33
|
# File 'lib/io_streams/s3/path.rb', line 30
def delete
object.delete
self
end
|
#exist? ⇒ Boolean
22
23
24
|
# File 'lib/io_streams/s3/path.rb', line 22
def exist?
object.exists?
end
|
#mkdir ⇒ Object
18
19
20
|
# File 'lib/io_streams/s3/path.rb', line 18
def mkdir
self
end
|
#mkpath ⇒ Object
S3 logically creates paths when a key is set.
14
15
16
|
# File 'lib/io_streams/s3/path.rb', line 14
def mkpath
self
end
|
#size ⇒ Object
26
27
28
|
# File 'lib/io_streams/s3/path.rb', line 26
def size
object.size
end
|