[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problems with RUBY 1.8.2 and RUDL 0.8

centrepins

1/4/2005 5:58:00 PM

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?
2 Answers

Bill Atkins

1/8/2005 9:10:00 PM

0

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.

Bill

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?
>
>


--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"


Bill Kelly

2/8/2005 4:33:00 AM

0

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