Method: TreasureData::API.normalized_msgpack

Defined in:
lib/td/client/api.rb

.normalized_msgpack(record, out = nil) ⇒ Object

Parameters:

  • record (Hash)
  • out (IO) (defaults to: nil)


129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/td/client/api.rb', line 129

def self.normalized_msgpack(record, out = nil)
  record.keys.each { |k|
    v = record[k]
    if v.kind_of?(Integer) && (v > MSGPACK_INT64_MAX || v < MSGPACK_INT64_MIN)
      record[k] = v.to_s
    end
  }
  if out
    out << record.to_msgpack
    out
  else
    record.to_msgpack
  end
end