Class: Rtype::Behavior::IntegerCheck

Inherits:
NumericCheck show all
Defined in:
lib/rtype/behavior/integer_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/integer_check.rb', line 12

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

#valid?(value) ⇒ Boolean

Returns:



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

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