# Xrcise problem

**URL:** <https://www.ruby-forum.com/t/xrcise-problem/179401>\
**Category:** wxRuby\
**Created:** [November 24, 2009, 6:40am UTC](https://www.ruby-forum.com/t/xrcise-problem/179401 "2009-11-24T06:40:24Z")\
**Posts on this page:** 1\
**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 24, 2009, 6:40am UTC](https://www.ruby-forum.com/t/xrcise-problem/179401/1 "2009-11-24T06:40:24Z")

</div>

Hello Mario.

From: Mario S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: General discussion of wxRuby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Mon, 23 Nov 2009 06:24:32 -0500  
Subject: Re: [wxruby-users] xrcise not working  
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

xrcise -rstring\_each -o TestWxFb.rb TestWxFb.xrc  
/home/myhome/gems/bin/xrcise: invalid option – r  
/opt/lib/ruby1.9/1.9.1/getoptlong.rb:392:in `set_error': invalid option -- r (GetoptLong::InvalidOption) from /opt/lib/ruby1.9/1.9.1/getoptlong.rb:569:in `get’  
from /opt/lib/ruby1.9/1.9.1/getoptlong.rb:600:in `block in each' from /opt/lib/ruby1.9/1.9.1/getoptlong.rb:599:in `loop’  
from /opt/lib/ruby1.9/1.9.1/getoptlong.rb:599:in `each' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:90:in `\<top  
(required)\>’  
from /home/myhome/gems/bin/xrcise:19:in `load' from /home/myhome/gems/bin/xrcise:19:in `’

> 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

I tried that but still got errors. A new release of wx\_sugar would be  
great. Thanks for your reply.

Philip
