Class: Flo

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

rtype [Flo > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


141
142
143
# File 'lib/rtype/behavior/core_ext.rb', line 141

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

.<=(x) ⇒ Proc

Examples:

Value must be a Float and > 2

rtype [Flo > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


149
150
151
# File 'lib/rtype/behavior/core_ext.rb', line 149

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

.==(x) ⇒ Proc

Examples:

Value must be a Float and > 2

rtype [Flo > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


157
158
159
# File 'lib/rtype/behavior/core_ext.rb', line 157

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

.>(x) ⇒ Proc

Examples:

Value must be a Float and > 2

rtype [Flo > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


125
126
127
# File 'lib/rtype/behavior/core_ext.rb', line 125

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

.>=(x) ⇒ Proc

Examples:

Value must be a Float and > 2

rtype [Flo > 2] => Any

Parameters:

  • x (Numeric)

Returns:

  • (Proc)


133
134
135
# File 'lib/rtype/behavior/core_ext.rb', line 133

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