Class: FakeFS::FakeFile::Inode
- Inherits:
-
Object
- Object
- FakeFS::FakeFile::Inode
- Defined in:
- lib/fakefs/fake/file.rb
Overview
Inode class
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.
9 10 11 12 13 14 15 |
# File 'lib/fakefs/fake/file.rb', line 9 def initialize(file_owner) # 1.9.3 when possible set default external encoding @content = '' @content = ''.encode( Encoding.default_external) if ''.respond_to?(:encode) @links = [file_owner] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
17 18 19 |
# File 'lib/fakefs/fake/file.rb', line 17 def content @content end |
#links ⇒ Object
Returns the value of attribute links.
18 19 20 |
# File 'lib/fakefs/fake/file.rb', line 18 def links @links end |
Instance Method Details
#clone ⇒ Object
29 30 31 32 33 |
# File 'lib/fakefs/fake/file.rb', line 29 def clone clone = super clone.content = content.dup clone end |
#link(file) ⇒ Object
20 21 22 23 |
# File 'lib/fakefs/fake/file.rb', line 20 def link(file) links << file unless links.include?(file) file.inode = self end |
#unlink(file) ⇒ Object
25 26 27 |
# File 'lib/fakefs/fake/file.rb', line 25 def unlink(file) links.delete(file) end |