Class: Contracts::Builtin::Neg

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

Overview

Check that an argument is a negative number.

Class Method Summary collapse

Class Method Details

.valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


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

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