class Jubatus::Common::TUserDef

Public Class Methods

new(type) click to toggle source
# File lib/jubatus/common/types.rb, line 195
def initialize(type)
  @type = type
end

Public Instance Methods

from_msgpack(m) click to toggle source
# File lib/jubatus/common/types.rb, line 199
def from_msgpack(m)
  return @type.from_msgpack(m)
end
to_msgpack(m) click to toggle source
# File lib/jubatus/common/types.rb, line 203
def to_msgpack(m)
  if @type === m
    return m.to_msgpack()
  elsif Array === m
    return @type::TYPE.to_msgpack(m)
  else
    raise TypeError, "type %s or Array are expected, but %s is given" % [@type, m.class]
  end
end