class FDB::DirectorySubspace
Attributes
directory_layer[R]
Public Class Methods
new(path, prefix, directory_layer=FDB::directory, layer='')
click to toggle source
Calls superclass method
# File lib/fdbdirectory.rb, line 501 def initialize(path, prefix, directory_layer=FDB::directory, layer='') super([], prefix) @path = path @layer = layer @directory_layer = directory_layer end
Public Instance Methods
create(db_or_tr, name_or_path, options={})
click to toggle source
# File lib/fdbdirectory.rb, line 528 def create(db_or_tr, name_or_path, options={}) path = tuplify_path(name_or_path) @directory_layer.create(db_or_tr, partition_subpath(path), options) end
create_or_open(db_or_tr, name_or_path, options={})
click to toggle source
# File lib/fdbdirectory.rb, line 518 def create_or_open(db_or_tr, name_or_path, options={}) path = tuplify_path(name_or_path) @directory_layer.create_or_open(db_or_tr, partition_subpath(path), options) end
exists?(db_or_tr, name_or_path=[])
click to toggle source
# File lib/fdbdirectory.rb, line 566 def exists?(db_or_tr, name_or_path=[]) path = tuplify_path(name_or_path) directory_layer = get_layer_for_path(path) directory_layer.exists?(db_or_tr, partition_subpath(path, directory_layer)) end
layer()
click to toggle source
# File lib/fdbdirectory.rb, line 512 def layer return @layer.dup end
list(db_or_tr, name_or_path=[])
click to toggle source
# File lib/fdbdirectory.rb, line 533 def list(db_or_tr, name_or_path=[]) path = tuplify_path(name_or_path) @directory_layer.list(db_or_tr, partition_subpath(path)) end
move(db_or_tr, old_name_or_path, new_name_or_path)
click to toggle source
# File lib/fdbdirectory.rb, line 538 def move(db_or_tr, old_name_or_path, new_name_or_path) old_path = tuplify_path(old_name_or_path) new_path = tuplify_path(new_name_or_path) @directory_layer.move(db_or_tr, partition_subpath(old_path), partition_subpath(new_path)) end
move_to(db_or_tr, new_absolute_name_or_path)
click to toggle source
# File lib/fdbdirectory.rb, line 544 def move_to(db_or_tr, new_absolute_name_or_path) directory_layer = get_layer_for_path([]) new_absolute_path = directory_layer.send(:to_unicode_path, new_absolute_name_or_path) partition_len = directory_layer.path.length partition_path = new_absolute_path[0...partition_len] raise ArgumentError, 'Cannot move between partitions.' if partition_path != directory_layer.path directory_layer.move(db_or_tr, @path[partition_len..-1], new_absolute_path[partition_len..-1]) end
open(db_or_tr, name_or_path, options={})
click to toggle source
# File lib/fdbdirectory.rb, line 523 def open(db_or_tr, name_or_path, options={}) path = tuplify_path(name_or_path) @directory_layer.open(db_or_tr, partition_subpath(path), options) end
path()
click to toggle source
# File lib/fdbdirectory.rb, line 508 def path return @path.dup end
remove(db_or_tr, name_or_path=[])
click to toggle source
# File lib/fdbdirectory.rb, line 554 def remove(db_or_tr, name_or_path=[]) path = tuplify_path(name_or_path) directory_layer = get_layer_for_path(path) directory_layer.remove(db_or_tr, partition_subpath(path, directory_layer)) end
remove_if_exists(db_or_tr, name_or_path=[])
click to toggle source
# File lib/fdbdirectory.rb, line 560 def remove_if_exists(db_or_tr, name_or_path=[]) path = tuplify_path(name_or_path) directory_layer = get_layer_for_path(path) directory_layer.remove_if_exists(db_or_tr, partition_subpath(path, directory_layer)) end
Private Instance Methods
get_layer_for_path(path)
click to toggle source
# File lib/fdbdirectory.rb, line 586 def get_layer_for_path(path) @directory_layer end
partition_subpath(path, directory_layer = @directory_layer)
click to toggle source
# File lib/fdbdirectory.rb, line 581 def partition_subpath(path, directory_layer = @directory_layer) self.path[directory_layer.path.length..-1] + path end
tuplify_path(path)
click to toggle source
# File lib/fdbdirectory.rb, line 572 def tuplify_path(path) if path.is_a? String [path] else path end end