# Xrcise now works

**URL:** <https://www.ruby-forum.com/t/xrcise-now-works/179433>\
**Category:** wxRuby\
**Created:** [November 24, 2009, 8:41pm UTC](https://www.ruby-forum.com/t/xrcise-now-works/179433 "2009-11-24T20:41:26Z")\
**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, 8:41pm UTC](https://www.ruby-forum.com/t/xrcise-now-works/179433/1 "2009-11-24T20:41:26Z")

</div>

Hi Mario,

The following change to outputter.rb did work for me. It looks like  
adding  
a routine to string should also work but it didn’t for me. Thanks for  
your  
help.

-Philip  
===== from RubyForge ==========  
Date: 2009-11-18 00:25  
Sender: Konstantin Shabanov

# After changing ‘each’ method to ‘each\_line’ in outputter.rb on lines 39 and 46 xrcise code generation seems to be working.

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

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
