Sha256: 8c60b2a7cb23da78c8744755972bd8f70e05d831f74af29dfe368427e430bd9b

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

module FunWith
  module Files
    module FileRequirements
      def _raise_error_if_not test, msg, error_class
        if test
          raise error_class.new( msg + "(file: #{self})" )
        end
      end
      
      def needs_to_be_a_file error_msg = "Path is not a file"
        _raise_error_if_not self.file?, error_msg, Errno::ENOENT
      end
      
      def needs_to_be_writable error_msg = "Path is not writable"
        _raise_error_if_not self.writable?, error_msg, Errno::ENOENT
      end
      
      def needs_to_be_empty error_msg = "Path needs to point to"
        _raise_error_if_not self.empty?, error_msg, Errno::ENOENT
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fun_with_files-0.0.15 ./lib/fun_with/files/file_requirements.rb
fun_with_files-0.0.14 ./lib/fun_with/files/file_requirements.rb
fun_with_files-0.0.13 ./lib/fun_with/files/file_requirements.rb
fun_with_files-0.0.12 ./lib/fun_with/files/file_requirements.rb