module FunWith::Files::FileRequirements

Public Instance Methods

_raise_error_if_not(test, msg, error_class) click to toggle source
# File lib/fun_with/files/file_requirements.rb, line 4
def _raise_error_if_not test, msg, error_class
  if test
    raise error_class.new( msg + "(file: #{self})" )
  end
end
needs_to_be_a_file(error_msg = "Path is not a file") click to toggle source
# File lib/fun_with/files/file_requirements.rb, line 10
def needs_to_be_a_file error_msg = "Path is not a file"
  _raise_error_if_not self.file?, error_msg, Errno::ENOENT
end
needs_to_be_empty(error_msg = "Path needs to point to") click to toggle source
# File lib/fun_with/files/file_requirements.rb, line 18
def needs_to_be_empty error_msg = "Path needs to point to"
  _raise_error_if_not self.empty?, error_msg, Errno::ENOENT
end
needs_to_be_writable(error_msg = "Path is not writable") click to toggle source
# File lib/fun_with/files/file_requirements.rb, line 14
def needs_to_be_writable error_msg = "Path is not writable"
  _raise_error_if_not self.writable?, error_msg, Errno::ENOENT
end