Class: Shoulda::Matchers::ActiveModel::NumericalityMatchers::EvenNumberMatcher
- Inherits:
-
NumericTypeMatcher
- Object
- NumericTypeMatcher
- Shoulda::Matchers::ActiveModel::NumericalityMatchers::EvenNumberMatcher
show all
- Defined in:
- lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb
Constant Summary
collapse
- NON_EVEN_NUMBER_VALUE =
1
Instance Method Summary
collapse
#allowed_type_name, #initialize
Instance Method Details
#allowed_type_adjective ⇒ Object
20
21
22
|
# File 'lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb', line 20
def allowed_type_adjective
'even'
end
|
#diff_to_compare ⇒ Object
24
25
26
|
# File 'lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb', line 24
def diff_to_compare
2
end
|
#simple_description ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb', line 9
def simple_description
description = ''
if expects_strict?
description << 'strictly '
end
description +
"disallow :#{attribute} from being an odd number"
end
|