Class: Jubatus::Common::TUserDef
- Inherits:
-
Object
- Object
- Jubatus::Common::TUserDef
- Defined in:
- lib/jubatus/common/types.rb
Instance Method Summary collapse
- #from_msgpack(m) ⇒ Object
-
#initialize(type) ⇒ TUserDef
constructor
A new instance of TUserDef.
- #to_msgpack(m) ⇒ Object
Constructor Details
#initialize(type) ⇒ TUserDef
Returns a new instance of TUserDef.
195 196 197 |
# File 'lib/jubatus/common/types.rb', line 195 def initialize(type) @type = type end |
Instance Method Details
#from_msgpack(m) ⇒ Object
199 200 201 |
# File 'lib/jubatus/common/types.rb', line 199 def from_msgpack(m) return @type.from_msgpack(m) end |
#to_msgpack(m) ⇒ Object
203 204 205 206 207 208 209 210 211 |
# 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 |