Class: GlusterFS::Directory
- Inherits:
-
Object
- Object
- GlusterFS::Directory
- Defined in:
- lib/glusterfs/directory.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Instance Method Summary collapse
- #create(perms = 0755) ⇒ Object
- #delete ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(volume, path) ⇒ Directory
constructor
A new instance of Directory.
- #lstat ⇒ Object
Constructor Details
#initialize(volume, path) ⇒ Directory
Returns a new instance of Directory.
3 4 5 6 |
# File 'lib/glusterfs/directory.rb', line 3 def initialize(volume, path) @volume = volume @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/glusterfs/directory.rb', line 2 def path @path end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
2 3 4 |
# File 'lib/glusterfs/directory.rb', line 2 def volume @volume end |
Instance Method Details
#create(perms = 0755) ⇒ Object
8 9 10 |
# File 'lib/glusterfs/directory.rb', line 8 def create(perms = 0755) GlusterFS.mkdir(@volume.fs, @path, perms) end |
#delete ⇒ Object
12 13 14 |
# File 'lib/glusterfs/directory.rb', line 12 def delete GlusterFS.rmdir(@volume.fs, @path) end |
#exists? ⇒ Boolean
22 23 24 |
# File 'lib/glusterfs/directory.rb', line 22 def exists? lstat[:st_size] > 0 end |
#lstat ⇒ Object
16 17 18 19 20 |
# File 'lib/glusterfs/directory.rb', line 16 def lstat data = GlusterFS::Stat.new GlusterFS.lstat(@volume.fs, @path, data) data end |