Hi Martin, you have a few issues in your code, I will go through them for you.

On 2/3/07, Martin Mler <usenet / martinopia.com> wrote:
> Hello
>
> I'm new to Ruby and unfortuantly I can't find an example anywhere to the
> following problem.
>
> I have the following class:
>
>
> class Article
>    attr_accessor :author
>    attr_accessor :title
>
>    def inititialize(author, title)

this should be spelled initialize, might be why you are getting an
argument error

>      @autor = author
>      @title = title
>    end
> end
>
>
> class Book
>    attr_accessor :year
>    attr_accessor :volume
>    attr_accessor :articles       # array of articles
>
>    def initialize(year, volume)
>      @year     = year
>      @volume   = volume
>      @articles = Array.new
>    end
>
>    def insert(author, title)
>      @articles.push(Article.new(author,title))
>    end
> end
>
>
> class Bookshelf
> ...
> end
>
>
> #create book
> testbook = Book.new(2007, 1)
>
> #insert 2 articles into the book
> testbook.insert("Martin Mueller", "Confessing that I'm a Ruby Dummy")
> testbook.insert("Hillary Clinton", "Elect me and Ruby will save our planet")
>
>
> #write Book to YAML

you also need to:
require 'yaml'

> File.open("testbook.yaml", "w") {|f| YAML.dump(testbook, f)}


> -----------------------
>
> My question is: how can I bring Ruby to save also the Array??
>
> I played around with  to_yaml_properties but without success.
>
> thanks a lot for any hint!
>
> Best regards,
> Martin.
>
>
>

Now it saves teh articles array

-- 
Chris Carter
concentrationstudios.com
brynmawrcs.com