Class: Contracts::Builtin::Nat
- Inherits:
-
Object
- Object
- Contracts::Builtin::Nat
- Defined in:
- lib/contracts-ruby2/lib/contracts/builtin_contracts.rb,
lib/contracts-ruby3/lib/contracts/builtin_contracts.rb
Overview
Check that an argument is a natural number (includes zero).
Class Method Summary collapse
Class Method Details
.valid?(val) ⇒ Boolean
53 54 55 |
# File 'lib/contracts-ruby2/lib/contracts/builtin_contracts.rb', line 53 def self.valid? val val && val.is_a?(Integer) && val >= 0 end |