instance method
inclusion_method
Ruby on Rails 3.2.22.5
Since v3.1.12 Last seen in v3.2.22.5 PrivateAvailable in: v3.1.12 v3.2.22.5
Signature
inclusion_method(enumerable)
In Ruby 1.9 Range#include? on non-numeric ranges checks all possible values in the range for equality, so it may be slow for large ranges. The new Range#cover? uses the previous logic of comparing a value with the range endpoints.
Parameters
-
enumerablereq
Source
# File activemodel/lib/active_model/validations/exclusion.rb, line 33
def inclusion_method(enumerable)
enumerable.is_a?(Range) ? :cover? : :include?
end
Defined in activemodel/lib/active_model/validations/exclusion.rb line 33
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Validations::ExclusionValidator