Class: IOStreams::S3::Path

Inherits:
BasePath show all
Defined in:
lib/io_streams/s3/path.rb

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

#deleteObject



30
31
32
33
# File 'lib/io_streams/s3/path.rb', line 30

def delete
  object.delete
  self
end

#exist?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/io_streams/s3/path.rb', line 22

def exist?
  object.exists?
end

#mkdirObject



18
19
20
# File 'lib/io_streams/s3/path.rb', line 18

def mkdir
  self
end

#mkpathObject

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

#sizeObject



26
27
28
# File 'lib/io_streams/s3/path.rb', line 26

def size
  object.size
end