Class: Num

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 Numeric and > 2

rtype [Num > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


57
58
59
# File 'lib/rtype/behavior/core_ext.rb', line 57

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

.<=(x) ⇒ Proc

Examples:

Value must be a Numeric and > 2

rtype [Num > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


65
66
67
# File 'lib/rtype/behavior/core_ext.rb', line 65

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

.==(x) ⇒ Proc

Examples:

Value must be a Numeric and > 2

rtype [Num > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


73
74
75
# File 'lib/rtype/behavior/core_ext.rb', line 73

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

.>(x) ⇒ Proc

Examples:

Value must be a Numeric and > 2

rtype [Num > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


41
42
43
# File 'lib/rtype/behavior/core_ext.rb', line 41

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

.>=(x) ⇒ Proc

Examples:

Value must be a Numeric and > 2

rtype [Num > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


49
50
51
# File 'lib/rtype/behavior/core_ext.rb', line 49

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