Module: Concurrent::Actor::TypeCheck
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
| Included In: AbstractContext,ActorTerminated,Behaviour::Abstract,Behaviour::Awaits,Behaviour::Buffer,Behaviour::ErrorsOnUnknownMessage,Behaviour::ExecutesContext,Behaviour::Linking,Behaviour::Pausing,Behaviour::RemovesChild,Behaviour::SetResults,Behaviour::Supervising,Behaviour::Termination,Context,Core,DefaultDeadLetterHandler,Envelope,Reference,RestartingContext,Root,UnknownMessage,Utils::AdHoc,Utils::Balancer,Utils::Broadcast,Utils::Pool | |
| Defined in: | lib/concurrent-ruby-edge/concurrent/actor/type_check.rb | 
Overview
taken from Algebrick supplies type-checking helpers whenever included
Class Method Summary
- .error(value, message, types) private
Instance Method Summary
Class Method Details
.error(value, message, types) (private)
# File 'lib/concurrent-ruby-edge/concurrent/actor/type_check.rb', line 41
def self.error(value, , types) raise TypeError, "Value (#{value.class}) '#{value}' #{} any of: #{types.join('; ')}." end
Instance Method Details
Child!(value, *types)
[ GitHub ]
    Child?(value, *types)  ⇒ Boolean 
  
# File 'lib/concurrent-ruby-edge/concurrent/actor/type_check.rb', line 28
def Child?(value, *types) Type?(value, Class) && types.any? { |t| value <= t } end
Match!(value, *types)
[ GitHub ]
    Match?(value, *types)  ⇒ Boolean 
  
# File 'lib/concurrent-ruby-edge/concurrent/actor/type_check.rb', line 18
def Match?(value, *types) types.any? { |t| t === value } end
Type!(value, *types)
[ GitHub ]
    Type?(value, *types)  ⇒ Boolean 
  
# File 'lib/concurrent-ruby-edge/concurrent/actor/type_check.rb', line 8
def Type?(value, *types) types.any? { |t| value.is_a? t } end