class Rspec::Bash::BashStubMarshaller

Public Instance Methods

marshal(object_to_marshal) click to toggle source
# File lib/rspec/bash/server/bash_stub_marshaller.rb, line 13
def marshal(object_to_marshal)
  object_to_dump = Sparsify.sparse(object_to_marshal, sparse_array: true)
  JSON.pretty_generate(object_to_dump, indent: '', space: '')
end
unmarshal(message_to_unmarshal) click to toggle source
# File lib/rspec/bash/server/bash_stub_marshaller.rb, line 7
def unmarshal(message_to_unmarshal)
  object_to_unflatten = JSON.parse(message_to_unmarshal)
  unflattened_object = Sparsify.unsparse(object_to_unflatten)
  JSON.parse(JSON.dump(unflattened_object), symbolize_names: true)
end