Class: FileSystem::SymbolicLinkCreator
- Inherits:
-
FakeSymbolicLink
- Object
- FakeSymbolicLink
- FileSystem::SymbolicLinkCreator
- Defined in:
- lib/file_system/link/symbolic_link_creator.rb
Instance Attribute Summary
Attributes inherited from FakeSymbolicLink
Instance Method Summary collapse
Methods inherited from FakeSymbolicLink
#initialize, #is_dir?, #is_file?
Constructor Details
This class inherits a constructor from FileSystem::FakeSymbolicLink
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/file_system/link/symbolic_link_creator.rb', line 6 def create if !File.exist?(old_name) puts "Can't to link to '#{old_name}' since it does not exist" return end if File.exist?(new_name) puts "Can't create alias '#{new_name}' since a file of that name already exists" return end FileUtils.ln_s old_name, new_name end |
#exist?(name) ⇒ Boolean
18 19 20 |
# File 'lib/file_system/link/symbolic_link_creator.rb', line 18 def exist?(name) File.exist?(name) || File.symlink?(name) end |