Class: Contracts::Builtin::NatPos

Inherits:
Object
  • Object
show all
Defined in:
lib/contracts/builtin_contracts.rb

Overview

Check that an argument is a positive natural number (excludes zero).

Class Method Summary collapse

Class Method Details

.valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/contracts/builtin_contracts.rb', line 62

def self.valid? val
  val.is_a?(Integer) && val.positive?
end