Method: Crackup::FileSystemObject.from

Defined in:
lib/crackup/fs_object.rb

.from(path) ⇒ Object

Returns an instance of the appropriate FileSystemObject subclass to represent path.

Raises:



15
16
17
18
19
20
21
# File 'lib/crackup/fs_object.rb', line 15

def self.from(path)
  return Crackup::SymlinkObject.new(path) if File.symlink?(path)
  return Crackup::DirectoryObject.new(path) if File.directory?(path)
  return Crackup::FileObject.new(path) if File.file?(path)
  
  raise Crackup::Error, "Unsupported filesystem object: #{path}"
end