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.



6
7
8
9
# File 'lib/fakefs/fake/file.rb', line 6

def initialize(file_owner)
  @content = ""
  @links   = [file_owner]
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



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

def content
  @content
end

Returns the value of attribute links.



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

def links
  @links
end

Instance Method Details

#cloneObject



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

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


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


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

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