Class: FakeFS::FakeSymlink

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ FakeSymlink

Returns a new instance of FakeSymlink.



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

def initialize(target)
  @target = target
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)



28
29
30
# File 'lib/fakefs/fake/symlink.rb', line 28

def method_missing(*args, &block)
  entry.send(*args, &block)
end

Instance Attribute Details

#nameObject Also known as: to_s

Returns the value of attribute name.



3
4
5
# File 'lib/fakefs/fake/symlink.rb', line 3

def name
  @name
end

#targetObject

Returns the value of attribute target.



3
4
5
# File 'lib/fakefs/fake/symlink.rb', line 3

def target
  @target
end

Instance Method Details

#deleteObject



18
19
20
# File 'lib/fakefs/fake/symlink.rb', line 18

def delete
  parent.delete(self)
end

#entryObject



14
15
16
# File 'lib/fakefs/fake/symlink.rb', line 14

def entry
  FileSystem.find(target)
end

#inspectObject



10
11
12
# File 'lib/fakefs/fake/symlink.rb', line 10

def inspect
  "symlink(#{target.split('/').last})"
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/fakefs/fake/symlink.rb', line 22

def respond_to?(method)
  entry.respond_to?(method)
end