User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Ruby section within the Web Development category of DaniWeb, a massive community of 397,712 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,482 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Ruby advertiser: SELL YOUR PRODUCT TODAY !

how do you use marshal.dump in Ruby please?

Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation: pty is on a distinguished road 
Rep Power: 3
Solved Threads: 31
pty's Avatar
pty pty is offline Offline
Posting Pro in Training

Re: how do you use marshal.dump in Ruby please?

  #5  
Apr 23rd, 2007
Originally Posted by Gazco View Post
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
File.open('game', 'w+') do |f|
What does the string do and do please? Thanks once again for any help.


"w+" is a mode string; it truncates the file (or creates a new one if it doesn't exist)

|f| is a block. Basically it means that in the following code f refers to the file.

A quick example of a simple block:

>> 5.times do |i|
?> puts i.to_s
>> end
0
1
2
3
4
=> 5
Note to self... pocket cup
Reply With Quote  
All times are GMT -4. The time now is 2:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC