BTW I asked since what you did there kinda, sorta, makes sense in Python. But not in Ruby. On 3/21/06, Alder Green <alder.green / gmail.com> wrote: > The guide is cute, but I wouldn't recommend it as an actual tutorial. > Try Chris Pine's tut, or better yet the pickaxe2. > > There are a lot of ways to store structured data in Ruby. The most > common way in real world usage is plaintext mark format, like Yaml. > Google Yaml and read about it (somewhat like XML, only usually nicer > but less powerful). > > The other common way is Marshal: > > http://ruby-doc.org/core/classes/Marshal.html > > which makes sense sometimes. > > On 3/21/06, James Whittaker <jmwhittaker / gmail.com> wrote: > > Alder Green wrote: > > > Any Python experience by any chance? :) > > > > > > In wordlist.rb you create a *local variable* code_words. When you > > > require wordlist.rb, locals variable get created, then destroyed. Only > > > constants (classes, modules) survive. So you can either store that > > > hash as a constant (inside a module/class), or (cleaner, more > > > sensible) store it in some sort of serial representation format, e.g. > > > Yaml. > > > > > > Alder Green > > > > Thanks, but no no Python experience! > > > > Bit of a flaw in the book then at only chapter 4!! If the code does not > > work as described. > > > > It seems quite sensible what i'm trying to do, don't quite understand > > your YAML format, but basically how can I store variables, hashes etc in > > an external file then call them. > > > > This book has been praised but has anyone really tried the code? > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > >