Class: TSVAdapter::FloatArraySerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/scout/persist/tsv/serialize.rb

Constant Summary collapse

NIL_FLOAT =
-999.999

Class Method Summary collapse

Class Method Details

.dump(a) ⇒ Object



42
# File 'lib/scout/persist/tsv/serialize.rb', line 42

def self.dump(a); a.collect{|v| v || NIL_FLOAT}.pack("d*"); end

.load(str) ⇒ Object



43
# File 'lib/scout/persist/tsv/serialize.rb', line 43

def self.load(str); a = str.unpack("d*"); a.collect{|v| v == NIL_FLOAT ? nil : v}; end