Class: MiniDefender::Rules::Alpha
Class Method Summary
collapse
Instance Method Summary
collapse
#active?, available?, #bails?, #coerce, #default_value, #defaults?, #error_message, #excluded?, #force_coerce?, #implicit?, make, #priority, #stops?, #with_message
Class Method Details
.signature ⇒ Object
4
5
6
|
# File 'lib/mini_defender/rules/alpha.rb', line 4
def self.signature
'alpha'
end
|
Instance Method Details
#message(attribute, value, validator) ⇒ Object
12
13
14
|
# File 'lib/mini_defender/rules/alpha.rb', line 12
def message(attribute, value, validator)
'The field must only contain alphabetical characters.'
end
|
#passes?(attribute, value, validator) ⇒ Boolean
8
9
10
|
# File 'lib/mini_defender/rules/alpha.rb', line 8
def passes?(attribute, value, validator)
value.is_a?(String) && /^[a-zA-Z]+$/.match?(value)
end
|