Class: SimpleFS::FS
- Inherits:
-
Object
- Object
- SimpleFS::FS
- Defined in:
- lib/simple_fs.rb
Instance Method Summary collapse
- #copy(old_path, new_path, optopns = {}) ⇒ Object
- #create(path, data, optopns = {}) ⇒ Object
-
#initialize(fs_path) ⇒ FS
constructor
A new instance of FS.
- #move(old_path, new_path, optopns = {}) ⇒ Object
- #remove(path, optopns = {}) ⇒ Object
Constructor Details
Instance Method Details
#copy(old_path, new_path, optopns = {}) ⇒ Object
21 22 23 24 |
# File 'lib/simple_fs.rb', line 21 def copy(old_path, new_path, optopns = {}) @old = @db[:index].where(:path => old_path).first @db[:index].insert(:path => new_path, :file_id => @old[:file_id]) end |
#create(path, data, optopns = {}) ⇒ Object
30 31 32 33 |
# File 'lib/simple_fs.rb', line 30 def create(path, data, optopns = {}) file_id = @file_pool.puts data @db[:index].insert(:path => path, :file_id => file_id) end |
#move(old_path, new_path, optopns = {}) ⇒ Object
17 18 19 |
# File 'lib/simple_fs.rb', line 17 def move(old_path, new_path, optopns = {}) @db[:index].where(:path => old_path).update(:path => new_path) end |
#remove(path, optopns = {}) ⇒ Object
26 27 28 |
# File 'lib/simple_fs.rb', line 26 def remove(path, optopns = {}) @db[:index].where(:path => path).delete end |