Class: FakeFS::FakeFile::Inode
- Inherits:
-
Object
- Object
- FakeFS::FakeFile::Inode
- Defined in:
- lib/fakefs/fake/file.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#links ⇒ Object
Returns the value of attribute links.
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(file_owner) ⇒ Inode
constructor
A new instance of Inode.
- #link(file) ⇒ Object
- #unlink(file) ⇒ Object
Constructor Details
#initialize(file_owner) ⇒ Inode
Returns a new instance of Inode.
7 8 9 10 |
# File 'lib/fakefs/fake/file.rb', line 7 def initialize(file_owner) @content = "" @links = [file_owner] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
12 13 14 |
# File 'lib/fakefs/fake/file.rb', line 12 def content @content end |
#links ⇒ Object
Returns the value of attribute links.
13 14 15 |
# File 'lib/fakefs/fake/file.rb', line 13 def links @links end |
Instance Method Details
#clone ⇒ Object
24 25 26 27 28 |
# File 'lib/fakefs/fake/file.rb', line 24 def clone clone = super clone.content = content.dup clone end |
#link(file) ⇒ Object
15 16 17 18 |
# File 'lib/fakefs/fake/file.rb', line 15 def link(file) links << file unless links.include?(file) file.inode = self end |
#unlink(file) ⇒ Object
20 21 22 |
# File 'lib/fakefs/fake/file.rb', line 20 def unlink(file) links.delete(file) end |