Class: Rtype::Behavior::Not

Inherits:
Base show all
Defined in:
lib/rtype/behavior/not.rb

Instance Method Summary collapse

Methods inherited from Base

[]

Constructor Details

#initialize(*types) ⇒ Not

Returns a new instance of Not.



4
5
6
# File 'lib/rtype/behavior/not.rb', line 4

def initialize(*types)
	@types = types
end

Instance Method Details

#error_message(value) ⇒ Object



14
15
16
17
# File 'lib/rtype/behavior/not.rb', line 14

def error_message(value)
	arr = @types.map { |e| "NOT " + Rtype::type_error_message(e, value) }
	arr.join "\nAND "
end

#valid?(value) ⇒ Boolean

Returns:



8
9
10
11
12
# File 'lib/rtype/behavior/not.rb', line 8

def valid?(value)
	@types.all? do |e|
		!Rtype::valid?(e, value)
	end
end