Class: SBucketsDir

Inherits:
SBaseDir show all
Defined in:
lib/s3fsr.rb

Instance Method Summary collapse

Methods inherited from SBaseDir

#content_deleted, #contents, #get, #is_directory?, #is_file?, #size, #touch

Constructor Details

#initializeSBucketsDir

Returns a new instance of SBucketsDir.



208
209
210
# File 'lib/s3fsr.rb', line 208

def initialize
  @data = nil
end

Instance Method Details

#can_write_files?Boolean

Returns:

  • (Boolean)


211
212
213
# File 'lib/s3fsr.rb', line 211

def can_write_files?
  false
end

#create_dir(child_key) ⇒ Object



217
218
219
220
221
# File 'lib/s3fsr.rb', line 217

def create_dir child_key
  AWS::S3::Bucket.create(child_key)
  d = SBucketDir.new(self, child_key)
  get_contents[d.name] = d
end

#create_file(child_key, content) ⇒ Object



214
215
216
# File 'lib/s3fsr.rb', line 214

def create_file child_key, content
  raise 'cannot create files outside of a bucket'
end

#deleteObject



222
223
224
# File 'lib/s3fsr.rb', line 222

def delete
  raise 'cannot delete the buckets dir'
end

#nameObject



225
226
227
# File 'lib/s3fsr.rb', line 225

def name
  return 'buckets'
end

#path_to_key(child_key) ⇒ Object



228
229
230
231
232
# File 'lib/s3fsr.rb', line 228

def path_to_key child_key
  # if i == -1, this is for creating a bucket
  i = child_key.index('/')
  i != nil ? child_key[i+1..-1] : child_key
end