Class: Metasploit::Framework::ExecutablePathValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Metasploit::Framework::ExecutablePathValidator
- Defined in:
- app/validators/metasploit/framework/executable_path_validator.rb
Overview
This is a ActiveModel custom validator that assumes the attribute is supposed to be the path to a regular file. It checks whether the file exists and whether or not it is an executable file.
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
8 9 10 11 12 |
# File 'app/validators/metasploit/framework/executable_path_validator.rb', line 8 def validate_each(record, attribute, value) unless ::File.executable? value record.errors.add(attribute, ([:message] || "is not a valid path to an executable file")) end end |