Class: FakeFS::FakeSymlink
- Inherits:
-
Object
- Object
- FakeFS::FakeSymlink
- Defined in:
- lib/fakefs/fake/symlink.rb
Overview
Fake symlink class
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #delete ⇒ Object
- #entry ⇒ Object
-
#initialize(target) ⇒ FakeSymlink
constructor
A new instance of FakeSymlink.
- #inspect ⇒ Object
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(target) ⇒ FakeSymlink
Returns a new instance of FakeSymlink.
8 9 10 |
# File 'lib/fakefs/fake/symlink.rb', line 8 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)
34 35 36 |
# File 'lib/fakefs/fake/symlink.rb', line 34 def method_missing(*args, &block) entry.send(*args, &block) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/fakefs/fake/symlink.rb', line 6 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
6 7 8 |
# File 'lib/fakefs/fake/symlink.rb', line 6 def parent @parent end |
#target ⇒ Object
Returns the value of attribute target.
6 7 8 |
# File 'lib/fakefs/fake/symlink.rb', line 6 def target @target end |
Instance Method Details
#delete ⇒ Object
20 21 22 |
# File 'lib/fakefs/fake/symlink.rb', line 20 def delete parent.delete(self) end |
#entry ⇒ Object
16 17 18 |
# File 'lib/fakefs/fake/symlink.rb', line 16 def entry FileSystem.find(File.(target.to_s, parent.to_s)) end |
#inspect ⇒ Object
12 13 14 |
# File 'lib/fakefs/fake/symlink.rb', line 12 def inspect "symlink(#{name} -> #{target.split('/').last})" end |
#respond_to_missing?(method, include_private = false) ⇒ Boolean
28 29 30 |
# File 'lib/fakefs/fake/symlink.rb', line 28 def respond_to_missing?(method, include_private = false) entry.respond_to?(method, include_private) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/fakefs/fake/symlink.rb', line 24 def to_s File.join(parent.to_s, name) end |