Class: SimpleImagesDownloader::Validatable::FileAccessibilityValidator

Inherits:
Validator
  • Object
show all
Defined in:
lib/simple_images_downloader/validatable/file_accessibility_validator.rb

Overview

FileAccessibilityValidator class Responsible for validating file accessibility

Examples:

SimpleImagesDownloader::FileAccessibilityValidator.new.validate({ path: './urls.txt' })

Instance Method Summary collapse

Instance Method Details

#validate(options) ⇒ Object

Parameters:

  • options (Hash)

    hash with path to file

Raises:



14
15
16
17
18
# File 'lib/simple_images_downloader/validatable/file_accessibility_validator.rb', line 14

def validate(options)
  return if File.readable?(options[:path])

  raise Errors::PermissionsError, options[:path]
end