Class: OsCtld::Assets::Symlink

Inherits:
BaseFile show all
Defined in:
lib/osctld/assets/symlink.rb

Instance Attribute Summary

Attributes inherited from Base

#errors, #opts, #path

Instance Method Summary collapse

Methods inherited from BaseFile

#exist?, #initialize, #mode

Methods inherited from Base

#add_error, #initialize, register, #state, type, #type, #validate, #validate?

Constructor Details

This class inherits a constructor from OsCtld::Assets::BaseFile

Instance Method Details

#statObject (protected)



17
18
19
# File 'lib/osctld/assets/symlink.rb', line 17

def stat
  @stat ||= File.lstat(path)
end

#valid?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'lib/osctld/assets/symlink.rb', line 7

def valid?
  add_error('not a symlink') if exist? && !opts[:optional] && !stat.symlink?
  super

rescue Errno::ENOENT
  add_error('does not exist')
  false
end