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.



156
157
158
# File 'lib/s3fsr.rb', line 156

def initialize
  @data = nil
end

Instance Method Details

#can_write_files?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/s3fsr.rb', line 159

def can_write_files?
  false
end

#create_dir(child_key) ⇒ Object



165
166
167
168
# File 'lib/s3fsr.rb', line 165

def create_dir child_key
  AWS::S3::Bucket.create(child_key)
  get_contents << SBucketDir.new(self, child_key)
end

#create_file(child_key, content) ⇒ Object



162
163
164
# File 'lib/s3fsr.rb', line 162

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

#deleteObject



169
170
171
# File 'lib/s3fsr.rb', line 169

def delete
  raise 'cannot delete the buckets dir'
end

#nameObject



172
173
174
# File 'lib/s3fsr.rb', line 172

def name
  return 'buckets'
end

#path_to_key(child_key) ⇒ Object



175
176
177
178
179
# File 'lib/s3fsr.rb', line 175

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