| | |
how do you use marshal.dump in Ruby please?
Please support our Ruby advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Hey, I'm learning Ruby and I've just about got it sorted. I have just one (or maybe more) question(s): What is marshal.dump and does it allow you to save data to a file outside of the Ruby program? If not, how do I create saved data (ie. character attributes inside a text-based game)? Thanks for answers!
•
•
•
•
Hey, I'm learning Ruby and I've just about got it sorted. I have just one (or maybe more) question(s): What is marshal.dump and does it allow you to save data to a file outside of the Ruby program? If not, how do I create saved data (ie. character attributes inside a text-based game)? Thanks for answers!
Note to self... pocket cup
•
•
Join Date: Apr 2007
Posts: 9
Reputation:
Solved Threads: 1
•
•
•
•
Hey, I'm learning Ruby and I've just about got it sorted. I have just one (or maybe more) question(s): What is marshal.dump and does it allow you to save data to a file outside of the Ruby program? If not, how do I create saved data (ie. character attributes inside a text-based game)? Thanks for answers!
http://sitekreator.com/satishtalim/o...alization.html
Hope that helps.
Satish Talim
Learning Ruby
Learning Ruby
Thanks, these sites really helped a lot and answered my questions, but the last one also brought up one little one: in the second example the programmer used What does the string do and do please? Thanks once again for any help.
Ruby Syntax (Toggle Plain Text)
File.open('game', 'w+') do |f|
Ruby Syntax (Toggle Plain Text)
'w+'
Ruby Syntax (Toggle Plain Text)
|f|
•
•
•
•
Thanks, these sites really helped a lot and answered my questions, but the last one also brought up one little one: in the second example the programmer usedWhat does the stringRuby Syntax (Toggle Plain Text)
File.open('game', 'w+') do |f|do andRuby Syntax (Toggle Plain Text)
'w+'do please? Thanks once again for any help.Ruby Syntax (Toggle Plain Text)
|f|
|f| is a block. Basically it means that in the following code f refers to the file.
A quick example of a simple block:
Ruby Syntax (Toggle Plain Text)
>> 5.times do |i| ?> puts i.to_s >> end 0 1 2 3 4 => 5
Note to self... pocket cup
![]() |
Similar Threads
- Anyone want to learn Ruby (Ruby)
- need help with learning ruby (Ruby)
Other Threads in the Ruby Forum
- Previous Thread: Ruby, Rails Job sites - Resource
- Next Thread: What do you think of Ruby?
| Thread Tools | Search this Thread |





