Class: Contracts::Builtin::Nat
- Inherits:
-
Object
- Object
- Contracts::Builtin::Nat
- Defined in:
- 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
49 50 51 |
# File 'lib/contracts/builtin_contracts.rb', line 49 def self.valid?(val) val && val.is_a?(Integer) && val >= 0 end |