Class: SFile

Inherits:
Object
  • Object
show all
Defined in:
lib/s3fsr.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, s3obj) ⇒ SFile

Returns a new instance of SFile.



24
25
26
27
28
# File 'lib/s3fsr.rb', line 24

def initialize(parent, s3obj)
  @parent = parent
  @s3obj = s3obj
  @name = last_part(@s3obj.key)
end

Instance Method Details

#deleteObject



44
45
46
47
# File 'lib/s3fsr.rb', line 44

def delete
  AWS::S3::S3Object.delete @s3obj.key, @s3obj.bucket.name
  @parent.content_deleted name
end

#is_directory?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/s3fsr.rb', line 32

def is_directory?
  false
end

#is_file?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/s3fsr.rb', line 35

def is_file?
  true
end

#nameObject



29
30
31
# File 'lib/s3fsr.rb', line 29

def name
  @name
end

#sizeObject



48
49
50
# File 'lib/s3fsr.rb', line 48

def size
  @s3obj.content_length
end

#touchObject



51
52
# File 'lib/s3fsr.rb', line 51

def touch
end

#valueObject



38
39
40
# File 'lib/s3fsr.rb', line 38

def value
  @s3obj.value(:reload)
end

#write(data) ⇒ Object



41
42
43
# File 'lib/s3fsr.rb', line 41

def write data
  AWS::S3::S3Object.store @s3obj.key, data, @s3obj.bucket.name, @s3obj.about.to_headers
end