Class: TSV::FloatArraySerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rbbt/tsv/serializers.rb

Constant Summary collapse

NIL_FLOAT =
-999.999

Class Method Summary collapse

Class Method Details

.dump(a) ⇒ Object



42
# File 'lib/rbbt/tsv/serializers.rb', line 42

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

.load(str) ⇒ Object



43
# File 'lib/rbbt/tsv/serializers.rb', line 43

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