Class: Contracts::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

Instance Method Summary collapse

Class Method Details

.test_dataObject



46
47
48
# File 'lib/contracts/builtin_contracts.rb', line 46

def self.test_data
  (0..5).map { rand(999) + 1 }
end

.valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/contracts/builtin_contracts.rb', line 38

def self.valid? val
  val > 0
end

Instance Method Details

#testable?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/contracts/builtin_contracts.rb', line 42

def testable?
  true
end