Thanks Robert and Yuri,
As a ruby newbie I’m finding that I’m getting a little stuck. I’ve been
programming in Java/C like languages for about 15 years, so maybe I’m
just having trouble getting used to the brave new world, so perhaps
you’ll bear with me while I take you through some details.
I really like ruby but I’m finding it hard to get to the bottom of
things when I do get errors.
My current situation involves a module called Gruff. I’ve mailed my
problems to the gruff forums on rubyforge, and we’re working on it
there, however I’d really like to be able to help solve the problem
myself.
I’ve downloaded gruff and rmagick using gems, and I’m trying a gruff
code sample in irb (I previously tried an rmagick sample and that
works):
require ‘rubygems’
require ‘gruff’
g = Gruff::Line.new
require ‘rubygems’ returns a fail, and require ‘gruff’ gives an error,
but I can get it to just return false if I comment out the relevant line
of code in the gruff source.
Anyhow, when I type g = Gruff::Line.new I get the this error:
NameError: uninitialized constant Gruff
which I presume is telling me that we have failed to pull in the gruff
module - adjusting the capitalization is no help:
irb(main):004:0> g = gruff::Line.new
NameError: undefined local variable or method `gruff’ for
#Object:0x2959258
from (irb):4
The thing is I’m stuck as to how to proceed from here - is there some
way for me to interogate the system so I can find out why the require
‘gruff’ is failing?
As I understand it my path is set up fine:
irb(main):005:0> $:
=> [“d:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.9.2-mswin32/bin”,
“d:/ruby/lib/ruby/ge
ms/1.8/gems/RMagick-win32-1.9.2-mswin32/lib”,
“d:/ruby/lib/ruby/gems/1.8/gems/gruff-0.0.6/
bin”, “d:/ruby/lib/ruby/gems/1.8/gems/gruff-0.0.6/lib”,
“d:/ruby/lib/ruby/site_ruby/1.8”,
“d:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt”,
“d:/ruby/lib/ruby/site_ruby”, “d:/ruby/lib/r
uby/1.8”, “d:/ruby/lib/ruby/1.8/i386-mswin32”, “.”]
i.e. i get all the above after entering the require commands, despite
the fact that they return failures.
hmm, so actually writing all this out helped - as I just fixed the
problem. It seems that I needed to restart irb each time I made
modifications to the source code in order to see the continuing errors
being generated after my modifications.
I was confused beacause after throwing an error once, a repeat call to
require would just return false, without any error message. By
restarting irb and seeing the addtional errors, I commented out a load
of undef_method calls in rmagick.rb and now it all works.
Sometimes you just need to be able to explain these things to someone
Many thanks for your input
CHEERS> SAM
Robert K. wrote:
As far as I know there is no such comprehensive list (note, I may be wrong
here). But closely looking at the exception stack trace and the code it
points to you usually see what’s wrong very fast.