Class: Contracts::Builtin::Pos

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

Overview

Check that an argument is a positive number.

Class Method Summary collapse

Class Method Details

.valid?(val) ⇒ Boolean

Returns:

  • (Boolean)

34
35
36
# File 'lib/contracts/builtin_contracts.rb', line 34

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