Module: IceCube::Validations::Count
- Included in:
- IceCube::ValidatedRule
- Defined in:
- lib/ice_cube/validations/count.rb
Defined Under Namespace
Classes: Validation
Instance Method Summary collapse
- #count(max) ⇒ Object
-
#occurrence_count ⇒ Object
Value reader for limit.
Instance Method Details
#count(max) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ice_cube/validations/count.rb', line 10 def count(max) unless max.nil? || max.is_a?(Integer) raise ArgumentError, "Expecting Integer or nil value for count, got #{max.inspect}" end replace_validations_for(:count, max && [Validation.new(max, self)]) self end |
#occurrence_count ⇒ Object
Value reader for limit
6 7 8 |
# File 'lib/ice_cube/validations/count.rb', line 6 def occurrence_count (arr = @validations[:count]) && (val = arr[0]) && val.count end |