Class: Rtype::Behavior::FloatCheck

Inherits:
NumericCheck show all
Defined in:
lib/rtype/behavior/float_check.rb

Instance Method Summary collapse

Methods inherited from NumericCheck

#initialize

Methods inherited from Base

[]

Constructor Details

This class inherits a constructor from Rtype::Behavior::NumericCheck

Instance Method Details

#error_message(value) ⇒ Object



12
13
14
# File 'lib/rtype/behavior/float_check.rb', line 12

def error_message(value)
  "Expected #{value.inspect} to be a float #{@condition} #{@x}"
end

#valid?(value) ⇒ Boolean

Returns:



4
5
6
7
8
9
10
# File 'lib/rtype/behavior/float_check.rb', line 4

def valid?(value)
  if value.is_a?(Float)
    @lambda.call(value)
  else
    false
  end
end