Class: MiniDefender::Rules::CreditCard
- Inherits:
-
Luhn
show all
- Defined in:
- lib/mini_defender/rules/credit_card.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Luhn
#coerce, valid_luhn?
#active?, available?, #bails?, #coerce, #default_value, #defaults?, #error_message, #excluded?, #force_coerce?, #implicit?, make, #priority, #stops?, #with_message
Class Method Details
.signature ⇒ Object
6
7
8
|
# File 'lib/mini_defender/rules/credit_card.rb', line 6
def self.signature
'credit_card'
end
|
Instance Method Details
#message(attribute, value, validator) ⇒ Object
14
15
16
|
# File 'lib/mini_defender/rules/credit_card.rb', line 14
def message(attribute, value, validator)
'The value must be a proper credit/debit card number.'
end
|
#passes?(attribute, value, validator) ⇒ Boolean
10
11
12
|
# File 'lib/mini_defender/rules/credit_card.rb', line 10
def passes?(attribute, value, validator)
super(attribute, value, validator) && value.length >= 8 && value.length <= 19
end
|