Hi all,

I've a question about the :parameter notation.
I want to write a method that can hold several optional paramters

add_book    :title=>"El quijote", :author=> "Miguel de Cervantes"
add_book    :title=>"El quijote", :author=> "Miguel de Cervantes", :tag=>"novel"
add_book    :title=>"El quijote"

and i had  write the add_book mehod like this :

class Book
   attr_writer :title, :author
end

def add_book (book )
   puts "title : #{book.title} -- Author : #{book.author}"
end

but the interpreter said : ./bibliom.rb:7:in `add_book': undefined
method `title' for {:title=>"El quijote", :author=>"Miguel de
Cervantes"}:Hash (NoMethodError)

I also try to put a hash object in the incoming parameter, like that :

def add_book (book=[])  .... end

My question is how can i wirte a method with several optional
parameter and then acces they inside of the mehotd ?

Thanks


-- 
-------------------------------------
Pedro Del Gallego

Email              :   pedro.delgallego / gmail.com