# Ruby Cookbook - problem recipe

**URL:** <https://www.ruby-forum.com/t/ruby-cookbook-problem-recipe/82852>\
**Category:** Ruby\
**Created:** [January 21, 2007, 10:16pm UTC](https://www.ruby-forum.com/t/ruby-cookbook-problem-recipe/82852 "2007-01-21T22:16:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarazed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed8c4c/32.png) [@tarazed](https://www.ruby-forum.com/u/tarazed)\
**Post date:** [January 21, 2007, 10:16pm UTC](https://www.ruby-forum.com/t/ruby-cookbook-problem-recipe/82852/1 "2007-01-21T22:16:07Z")

</div>

Skipping through the Ruby Cookbook (Carlson & Richardson) I tried out  
the  
rubyTk stopwatch program, which worked fine, then tried the GTK version.  
I typed it in more or less verbatim but could not run it because the  
menuspec which is given as an array (see below) could not be converted  
to  
a string by the Gtk::ItemFactory create\_items method.

Extract from the initialize method of the Stopwatch class:

```
menu_factory = Gtk::ItemFactory.new( 

```

Gtk::ItemFactory::TYPE\_MENU\_BAR,  
‘’, nil )  
menuspec = [  
[  
[‘\_Program’],  
[ ‘/Program/\_Start’, ‘’, nil, nil, lambda {  
start } ],  
[ ‘/Program/S\_top’, ‘’, nil, nil, lambda { stop  
} ],  
[ ‘/Program/\_Exit’, ‘’, nil, nil,  
lambda { Gtk.main\_quit } ]  
],  
[  
[‘\_Reset’],  
[ ‘/Reset/\_Reset Stopwatch’, ‘’, nil, nil,  
lambda { reset } ]  
]  
]

```
menu_factory.create_items( menuspec )

```

The error message specifies the last line here as the problem. Have I  
missed something obvious? The OReilly website lists errata for the book  
but nothing for page 806 where this code snippet comes from. Should I  
be  
looking for version mismatches in GTK2 perhaps?

Len
