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.
6 7 8 9 |
# File 'lib/fakefs/fake/file.rb', line 6 def initialize(file_owner) @content = "" @links = [file_owner] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
11 12 13 |
# File 'lib/fakefs/fake/file.rb', line 11 def content @content end |
#links ⇒ Object
Returns the value of attribute links.
12 13 14 |
# File 'lib/fakefs/fake/file.rb', line 12 def links @links end |
Instance Method Details
#clone ⇒ Object
23 24 25 26 27 |
# File 'lib/fakefs/fake/file.rb', line 23 def clone clone = super clone.content = content.dup clone end |
#link(file) ⇒ Object
14 15 16 17 |
# File 'lib/fakefs/fake/file.rb', line 14 def link(file) links << file unless links.include?(file) file.inode = self end |
#unlink(file) ⇒ Object
19 20 21 |
# File 'lib/fakefs/fake/file.rb', line 19 def unlink(file) links.delete(file) end |