Class: FakeFS::FakeFile::Inode

Inherits:
Object
  • Object
show all
Defined in:
lib/fakefs/fake/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentObject

Returns the value of attribute content.



12
13
14
# File 'lib/fakefs/fake/file.rb', line 12

def content
  @content
end

Returns the value of attribute links.



13
14
15
# File 'lib/fakefs/fake/file.rb', line 13

def links
  @links
end

Instance Method Details

#cloneObject



24
25
26
27
28
# File 'lib/fakefs/fake/file.rb', line 24

def clone
  clone = super
  clone.content = content.dup
  clone
end


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


20
21
22
# File 'lib/fakefs/fake/file.rb', line 20

def unlink(file)
  links.delete(file)
end