# Xrcise not working

**URL:** <https://www.ruby-forum.com/t/xrcise-not-working/179347>\
**Category:** wxRuby\
**Created:** [November 23, 2009, 3:29am UTC](https://www.ruby-forum.com/t/xrcise-not-working/179347 "2009-11-23T03:29:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pnomolos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/85f322/32.png) [@pnomolos](https://www.ruby-forum.com/u/pnomolos)\
**Post date:** [November 23, 2009, 3:29am UTC](https://www.ruby-forum.com/t/xrcise-not-working/179347/1 "2009-11-23T03:29:13Z")

</div>

Hi. I’m back. Unfortunately I can’t get xrcise working. Here is the  
sample xrc file and the resulting error messages:

=============== TestWxFb.xrc =========================================

# \<?xml version="1.0" encoding="UTF-8" standalone="yes" ?\> wxDEFAULT\_FRAME\_STYLE|wxTAB\_TRAVERSAL 500,300 Minimal wxVERTICAL 0 wxALL|wxALIGN\_CENTER\_HORIZONTAL 5 Test 1 wxEXPAND 5 wxHORIZONTAL 0 wxALL 5 Username 0 wxALL 5 0 1 wxEXPAND 5 wxHORIZONTAL 0 wxALL 5 MyLabel 0 wxALL 5 0

xxx:~/Desktop/Eyes$ xrcise -o TestWxFb.rb TestWxFb.xrc  
/home/myhome/gems/gems/wx\_sugar-0.1.22/lib/wx\_sugar/xrc/outputter.rb:46:in  
`clean_id_attr_readers': undefined method`each’ for #String:0x859ff44  
(NoMethodError)  
from (erb):16:in `output' from /opt/lib/ruby1.9/1.9.1/erb.rb:753:in`eval’  
from /opt/lib/ruby1.9/1.9.1/erb.rb:753:in `result' from /home/myhome/gems/gems/wx_sugar-0.1.22/lib/wx_sugar/xrc/outputter.rb:19:in`output’  
from /home/myhome/gems/gems/wx\_sugar-0.1.22/bin/xrcise:126:in `block (2 levels) in <top (required)>' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:125:in`each’  
from /home/myhome/gems/gems/wx\_sugar-0.1.22/bin/xrcise:125:in `block in <top (required)>' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:124:in`open’  
from /home/myhome/gems/gems/wx\_sugar-0.1.22/bin/xrcise:124:in `<top (required)>' from /home/myhome/gems/bin/xrcise:19:in`load’  
from /home/myhome/gems/bin/xrcise:19:in `’

wxFormbuilder 3.0  
wx\_sugar version 0.1.22  
wxruby-ruby19-2.0.1-x86-linux  
wx\_sugar-0.1.22  
Ubuntu version 9.10 (Karmic Koala)

=============== .bashrc file ========================================

PATH=/opt/bin:/home/myhome/gems/bin:$PATH  
LD\_LIBRARY\_PATH=/opt/lib:$LD\_LIBRARY\_PATH  
export GEM\_HOME=/home/myhome/gems

How do I make xrcise work properly? Thanks.

- Philip

---

<div class="post-metadata">

**Author:** ![pnomolos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/85f322/32.png) [@pnomolos](https://www.ruby-forum.com/u/pnomolos)\
**Post date:** [November 23, 2009, 12:25pm UTC](https://www.ruby-forum.com/t/xrcise-not-working/179347/2 "2009-11-23T12:25:17Z")

</div>

Hello Philip,

The problem you are having, is the fact that Ruby 1.9 String standard  
class  
no longer implements the each method on it. Which basically, for  
string,  
each splits the lines at the \n terminator, returning each line to the  
block, so you need to create a library file, and have it included, as  
follows:

string\_each.rb:

class String  
def each  
self.split("\n").each do |line|  
yield line  
end  
end  
end

Then there’s two ways you can work this, either on the command line, do  
the  
following:

xrcise -rstring\_each -o TestWxFb.rb TestWxFb.xrc

Or, modify the xrcise script itself, found in  
/home/myhome/gems/gems/wx\_sugar-0.1.22/bin/xrcise

And add a require ‘string\_each’ before any other require. I will see  
about  
fixing this bug, and doing a new release of wx\_sugar to fix this problem  
with Ruby 1.9, along with any other outstanding bugs that I can find in  
regards to wx\_sugar.

hth,

Mario
