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
8 9 10 11 12 13 14 |
# File 'lib/ice_cube/validations/count.rb', line 8 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
4 5 6 |
# File 'lib/ice_cube/validations/count.rb', line 4 def occurrence_count (arr = @validations[:count]) && (val = arr[0]) && val.count end |