class Jubatus::Common::MessageStringGenerator

Constants

CLOSE
COLON
DELIMITER
OPEN

Public Class Methods

new() click to toggle source
# File lib/jubatus/common/message_string_generator.rb, line 10
def initialize()
  @buf = []
  @first = true
end

Public Instance Methods

add(key, value) click to toggle source
# File lib/jubatus/common/message_string_generator.rb, line 20
def add(key, value)
  if @first
    @first = false
  else
    @buf << DELIMITER
  end
  @buf << key.to_s
  @buf << COLON
  @buf << value.to_s
end
close() click to toggle source
# File lib/jubatus/common/message_string_generator.rb, line 31
def close
  @buf << CLOSE
end
open(typ) click to toggle source
# File lib/jubatus/common/message_string_generator.rb, line 15
def open(typ)
  @buf << typ.to_s
  @buf << OPEN
end
to_s() click to toggle source
# File lib/jubatus/common/message_string_generator.rb, line 35
def to_s
  @buf.join
end