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.
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)
rubocop:disable Style/MethodMissingSuper
32 33 34 |
# File 'lib/fakefs/fake/symlink.rb', line 32 def method_missing(*args, &block) # rubocop:disable Style/MethodMissingSuper entry.send(*args, &block) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/fakefs/fake/symlink.rb', line 4 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
4 5 6 |
# File 'lib/fakefs/fake/symlink.rb', line 4 def parent @parent end |
#target ⇒ Object
Returns the value of attribute target.
4 5 6 |
# File 'lib/fakefs/fake/symlink.rb', line 4 def target @target end |
Instance Method Details
#delete ⇒ Object
18 19 20 |
# File 'lib/fakefs/fake/symlink.rb', line 18 def delete parent.delete(self) end |
#entry ⇒ Object
14 15 16 |
# File 'lib/fakefs/fake/symlink.rb', line 14 def entry FileSystem.find(File.(target.to_s, parent.to_s)) end |
#inspect ⇒ Object
10 11 12 |
# File 'lib/fakefs/fake/symlink.rb', line 10 def inspect "symlink(#{name} -> #{target.split('/').last})" end |
#respond_to_missing?(method, include_private = false) ⇒ Boolean
26 27 28 |
# File 'lib/fakefs/fake/symlink.rb', line 26 def respond_to_missing?(method, include_private = false) entry.respond_to?(method, include_private) end |