Class: TSV::IntegerArraySerializer

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

Constant Summary collapse

NIL_INT =
-999

Class Method Summary collapse

Class Method Details

.dump(a) ⇒ Object



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

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

.load(str) ⇒ Object



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

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