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.



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

def initialize
  @data = nil
end

Instance Method Details

#can_write_files?Boolean

Returns:

  • (Boolean)


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

def can_write_files?
  false
end

#create_dir(child_key) ⇒ Object



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

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



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

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

#deleteObject



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

def delete
  raise 'cannot delete the buckets dir'
end

#nameObject



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

def name
  return 'buckets'
end

#path_to_key(child_key) ⇒ Object



232
233
234
235
236
# File 'lib/s3fsr.rb', line 232

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