Bill Kelly
2/8/2005 4:33:00 AM
From: "Bill Atkins" <batkins57@gmail.com>
>
> On Wed, 5 Jan 2005 03:01:34 +0900, Glenn <centrepins@gmail.com> wrote:
> > While learning RUBY a while ago I used RUBY 1.8.1 and RUDL 0.7.1 to
> > write pacman (just as a learning process) and all was well.
> >
> > Now I've upgraded to RUBY 1.8.2 and RUDL 0.8 I get the following
> > message as soon as I run the game:
> >
> > (eval):114: undefined method `print_centered' for class `RUDL::SFont'
> > (NameError)
> > from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
> > `require'
> > from D:/PacMan/pacman.rb:10
> >
> > Any ideas?
>
> Yeah, this happened to me too. It's related to the new version of
> RubyGems, but I haven't gotten a response about it yet.
>
> The workaround is to use "require__ 'RUDL'" instead of "require RUDL"
> - not a solution, but it will get you through until the bug is fixed.
I'm seeing this problem too.
I just built RUDL 0.8 from source; my Ruby is:
ruby 1.8.2 (2004-12-25) [i386-mswin32] (one-click installer)
I get the same thing as above. Here, from irb:
irb(main):001:0> require 'RUDL'
NameError: undefined method `print_centered' for class `RUDL::SFont'
from (eval):114
from C:/dev/ruby-1.8.2-14/lib/ruby/site_ruby/1.8/
rubygems/loadpath_manager.rb:5:in `require'
from (irb):1
irb(main):001:0> require__ 'RUDL'
=> true
Knowing nothing about RubyGems, I'm not sure what to make
of it. Looking at the RUDL code, the method SFont#print_centered
is defined at run-time by the C code, by evaluating ruby code.
It looks like:
void initSFontClasses()
{
classSFont=rb_define_class_under(moduleRUDL, "SFont", rb_cObject);
rb_define_singleton_method(classSFont, "new", sfont_new, 1);
rb_define_method(classSFont, "print", sfont_print, 3);
rb_define_method(classSFont, "size", sfont_size, 1);
add_sfont_print_centered(); // defines RUDL::SFont#print_centered
[...]
}
static void add_sfont_print_centered()
{
rb_eval_string(
"module RUDL class SFont \n"
" def print_centered(surface, y, text) \n"
" print(surface,[(surface.w-size(text)[0])/2,y],text) \n"
" self \n"
" end \n"
"end end \n"
);
}
Any Gems gurus out there have any thoughts? Anything you'd
like me to try? BTW, 'RUDL' is => RUDL.so, not RUDL.rb, if
that makes a difference.
Thanks,
Regards,
Bill