module Attribool::Validators

Namespace for Validators. Also provides a method for fetching a validator.

Public Instance Methods

fetch(validator_name) click to toggle source

Fetches a Validator class.

@param [String, Symbol] validator_name

@return [Class]

@example

Attribool::Validators.fetch(:nil_attribute)
# => NilAttributeValidator
# File lib/attribool/validators.rb, line 19
def fetch(validator_name)
  const_get(
    "#{validator_name.to_s.split("_").map(&:capitalize).join}Validator"
  )
end