This Erlang library deserialises Ruby objects dumped by Marshal.dump into
Erlang terms. It's like Ruby's Marshal.load, but for
Erlang. Currently, it doesn't support loading advanced objects like classes, but
the bare minimum is supported. The list of supported objects includes:
- Fixnum
- Hash
- Array
- Bignum
- Symbol
- Float
- String
%% rebar.config
{deps, [
{rmarshal, {git, "git://github.com/kyrylo/rmarshal.git", {tag, "v0.0.4"}}}
]}.Dump some Ruby objects into a binary file:
# data.rb
data = Marshal.dump(hello: 'world')
File.open('data.dat', 'w') do |f|
f.write(data)
endRead the dumped data with Erlang and load it with help of the RMarshal library:
%% loader.erl
load_ruby_data() ->
case file:read_file("data.dat") of
{ok, BinaryData} -> rmarshal:load(BinaryData);
Any -> Any
end.
load_ruby_data()
%% Returns:
%% {ok, #{hello => "world"}}Accepts binary string formatted according to the official
Marshal Format. Returns a tuple with in the format {ok, rterm()}.
{ok, Decoded} = rmarshal:load(BinaryData).Run the following command:
make test- ≥17.0
In case you have a problem, question or a bug report, feel free to:
The project uses the zlib License. See the LICENCE.txt file for more information.