Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 99881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:28:22+00:00 2026-05-11T00:28:22+00:00

I have found some info on the subject ( like this link) , but

  • 0

I have found some info on the subject (like this link), but nothing that tells me how it actually works under the covers. If you don’t want to read the essay below, here are the real questions:

  1. How should I implement the marshal_dump and marshal_load methods? even a simple example will do.

  2. when marshal_load is called, how does it ‘know’ which type of object to create? If there are multiple objects of the same type in the file, how do you tell which is which? I am obviously confused…

  3. if I have an object which represents an image, is there a different way to write it out to disk?

My specific problem is this:

It is a bit complicated because I do not have the source code for the object I wish to serialize.

I am working on a mod to a game engine (RPG Maker VX using the RGSS2 game library). There is a class called Bitmap which belongs to the (closed source) API. I would like to save this object/image between game plays, so I need to serialize it to the save file. I’m not a ruby pro, but I know that I can define two methods (marshal_dump and marshal_load) which will be called by the ‘Marshal’ module when I attempt to serialize the object.

The problem is that I do not know how to implement the two methods needed. I can actually just leave them as empty methods and it seems to work, but the object is actually disposed and the image data is gone. Besides that, I don’t understand what it is doing internally and obviously creating empty methods is just wrong.

So can anyone tell me how this stuff works internally? I think that would help me to solve my problem. Beyond that, is there another type of image format that I can use which I could just save to a file and avoid doing my own serialization?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:28:23+00:00Added an answer on May 11, 2026 at 12:28 am

    The Ruby marshalling methods store the type of the object they’re encoding. The way those two hooks work is like this:

    • marshal_dump has to return some data describing the state of your object. Ruby couldn’t care less about the format of this data — it just has to be something that your marshal_load method can use to reconstruct the object’s state.

    • marshal_load is called on the marshalled object just after it’s been recreated. It’s basically the initialize method for a marshalled object. It’s passed whatever object marshal_dump returned and has to use that data to reconstruct its state.

    Here’s an example:

    class Messenger    attr_accessor :name, :message    def marshal_dump     {'name' => name, 'message' => message}   end    def marshal_load(data)     self.name = data['name']     self.message = data['message']   end  end 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The documentation seems quite minimal - I don't think there… May 11, 2026 at 1:58 pm
  • added an answer In JavaScript, this represents the context object on which the… May 11, 2026 at 1:58 pm
  • added an answer Since your entry point in managed code, you'll need to… May 11, 2026 at 1:58 pm

Related Questions

I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not
I have found some libraries or web services in PHP that does the job.
After googling a bit I have found some tips about how to get online
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
I am writing a webservice that uses json to represent its resources, and I
How can I use WIA and Twain in C#? The TWIAIN/C# example found at
I'm talking about an action game with no upper score limit and no way
I'm having a problem with my compiler telling me there is an 'undefined reference

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.