module Jubatus::Common

Public Class Methods

check_type(value, typ) click to toggle source
# File lib/jubatus/common/types.rb, line 7
def self.check_type(value, typ)
  if not (typ === value)
    raise TypeError, "type %s is expected, but %s is given" % [typ, value.class]
  end
end
check_types(value, types) click to toggle source
# File lib/jubatus/common/types.rb, line 13
def self.check_types(value, types)
  types.each do |t|
    return if t === value
  end
  t = types.map { |t| t.to_s }.join(", ")
  raise TypeError, "type %s is expected, but %s is given" % [t, value.class]
end