Sha256: 30db27f5375d04c498aa59f42a430b2f24d36c143ee236e4435aa4716e900872
Contents?: true
Size: 549 Bytes
Versions: 3
Compression:
Stored size: 549 Bytes
Contents
# frozen_string_literal: true module Attribool ## # Namespace for Validators. Also provides a method for fetching a validator. module Validators module_function ## # Fetches a Validator class. # # @param [String, Symbol] validator_name # # @return [Class] # # @example # Attribool::Validators.fetch(:nil_attribute) # # => NilAttributeValidator def fetch(validator_name) const_get( "#{validator_name.to_s.split("_").map(&:capitalize).join}Validator" ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
attribool-2.0.5 | lib/attribool/validators.rb |
attribool-2.0.4 | lib/attribool/validators.rb |
attribool-2.0.3 | lib/attribool/validators.rb |