lib/erlectricity/decoder.rb in erlectricity-1.0.1 vs lib/erlectricity/decoder.rb in erlectricity-1.1.0
- old
+ new
@@ -96,10 +96,12 @@
case a
when "true"
true
when "false"
false
+ when ""
+ Marshal.load("\004\b:\005") # Workaround for inability to do ''.to_sym
else
a.to_sym
end
end
@@ -178,24 +180,24 @@
(0...arity).map { |i| read_any_raw }
end
def read_nil
fail("Invalid Type, not a nil list") unless read_1 == NIL
- []
+ Erlectricity::List.new([])
end
def read_erl_string
fail("Invalid Type, not an erlang string") unless read_1 == STRING
length = read_2
- read_string(length).unpack('C' * length)
+ Erlectricity::List.new(read_string(length).unpack('C' * length))
end
def read_list
fail("Invalid Type, not an erlang list") unless read_1 == LIST
length = read_4
list = (0...length).map { |i| read_any_raw }
read_1
- list
+ Erlectricity::List.new(list)
end
def read_bin
fail("Invalid Type, not an erlang binary") unless read_1 == BIN
length = read_4