Files

Class/Module Index [+]

Quicksearch

Concurrent::Actor::TypeCheck

taken from Algebrick supplies type-checking helpers whenever included

Public Instance Methods

Child!(value, *types) click to toggle source
# File lib/concurrent/actor/type_check.rb, line 33
def Child!(value, *types)
  Child?(value, *types) or
      TypeCheck.error(value, 'is not child', types)
  value
end
Child?(value, *types) click to toggle source
# File lib/concurrent/actor/type_check.rb, line 28
def Child?(value, *types)
  Type?(value, Class) &&
      types.any? { |t| value <= t }
end
Match!(value, *types) click to toggle source
# File lib/concurrent/actor/type_check.rb, line 22
def Match!(value, *types)
  Match?(value, *types) or
      TypeCheck.error(value, 'is not matching', types)
  value
end
Match?(value, *types) click to toggle source
# File lib/concurrent/actor/type_check.rb, line 18
def Match?(value, *types)
  types.any? { |t| t === value }
end
Type!(value, *types) click to toggle source
# File lib/concurrent/actor/type_check.rb, line 12
def Type!(value, *types)
  Type?(value, *types) or
      TypeCheck.error(value, 'is not', types)
  value
end
Type?(value, *types) click to toggle source
# File lib/concurrent/actor/type_check.rb, line 8
def Type?(value, *types)
  types.any? { |t| value.is_a? t }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.