Class: Jubatus::Weight::Feature
- Inherits:
-
Object
- Object
- Jubatus::Weight::Feature
- Includes:
- Common
- Defined in:
- lib/jubatus/weight/types.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key, value) ⇒ Feature
constructor
A new instance of Feature.
- #to_msgpack(out = '') ⇒ Object
- #to_s ⇒ Object
Methods included from Common
Constructor Details
#initialize(key, value) ⇒ Feature
Returns a new instance of Feature.
15 16 17 18 |
# File 'lib/jubatus/weight/types.rb', line 15 def initialize(key, value) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
39 40 41 |
# File 'lib/jubatus/weight/types.rb', line 39 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
39 40 41 |
# File 'lib/jubatus/weight/types.rb', line 39 def value @value end |
Class Method Details
Instance Method Details
#to_msgpack(out = '') ⇒ Object
20 21 22 23 |
# File 'lib/jubatus/weight/types.rb', line 20 def to_msgpack(out = '') t = [@key, @value] return TYPE.to_msgpack(t) end |
#to_s ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/jubatus/weight/types.rb', line 30 def to_s gen = Jubatus::Common::MessageStringGenerator.new gen.open("feature") gen.add("key", @key) gen.add("value", @value) gen.close() return gen.to_s end |