Class: Int

Inherits:
Object show all
Defined in:
lib/rtype/behavior/core_ext.rb

Class Method Summary collapse

Class Method Details

.<(x) ⇒ Proc

Examples:

Value must be a Integer and > 2

rtype [Int > 2] => Any

Parameters:

Returns:



99
100
101
# File 'lib/rtype/behavior/core_ext.rb', line 99

def self.<(x)
  lambda { |obj| obj.is_a?(Integer) && obj < x }
end

.<=(x) ⇒ Proc

Examples:

Value must be a Integer and > 2

rtype [Int > 2] => Any

Parameters:

Returns:



107
108
109
# File 'lib/rtype/behavior/core_ext.rb', line 107

def self.<=(x)
  lambda { |obj| obj.is_a?(Integer) && obj <= x }
end

.==(x) ⇒ Proc

Examples:

Value must be a Integer and > 2

rtype [Int > 2] => Any

Parameters:

Returns:



115
116
117
# File 'lib/rtype/behavior/core_ext.rb', line 115

def self.==(x)
  lambda { |obj| obj.is_a?(Integer) && obj == x }
end

.>(x) ⇒ Proc

Examples:

Value must be a Integer and > 2

rtype [Int > 2] => Any

Parameters:

Returns:



83
84
85
# File 'lib/rtype/behavior/core_ext.rb', line 83

def self.>(x)
  lambda { |obj| obj.is_a?(Integer) && obj > x }
end

.>=(x) ⇒ Proc

Examples:

Value must be a Integer and > 2

rtype [Int > 2] => Any

Parameters:

Returns:



91
92
93
# File 'lib/rtype/behavior/core_ext.rb', line 91

def self.>=(x)
  lambda { |obj| obj.is_a?(Integer) && obj >= x }
end