module IceCube::Validations::Count

Public Instance Methods

count(max) click to toggle source
# 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() click to toggle source

Value reader for limit

# File lib/ice_cube/validations/count.rb, line 6
def occurrence_count
  (arr = @validations[:count]) && (val = arr[0]) && val.count
end