I’m trying to call an instance method from within a gem (Treetop), and
nothing I’ve tried is working (3 hours into it - no results). I’ll do my
best to simplify the problem.
I have a class instance which sets things up with this…
Treetop.load '../data/sn_grammar' # <= this loads a data file which
will be process as Ruby, after some preprocessing
@parser = Base_grammarParser.new # < = Treetop class instance
My class method with the code above then calls another method in the
same class - both in my module SN, class SetNet.
The other method then calls a method of the @parser instance, and THAT
one gives to eval some of the text in the sn_grammar file referenced in
the first code line above. That text then calls another method -
showhelp - back in my class instance. But it cannot find it. I’m not
naming it correctly, somehow. I get this error:
(eval):71:in act': undefined method
showhelp’ for SyntaxNode+HelpMain0
offset=0, “.h”:Treetop::Runtime::SyntaxNode (NoMethodError)
from …/lib/setnet/SN.rb:265:in proc_command' from ../lib/setnet/SN.rb:182:in
user_interface’
from …/lib/setnet/SN.rb:113:in manage' from ../lib/setnet/SN.rb:38:in
startup’
from ./setnet:26
I’ve tried every permutation I can image, to tell eval how to find my
method. No go.
Module SN => class SetNet => instance setnet => method showhelp. <=
That’s what I’m trying to get to.
How can I tell eval, executing off in the gem directory, where this
method is found? That’s my problem, I think. I’m run out of
possibilities, so I’m failing to grasp something basic most likely.
Any help would be appreciated.
Tom
–
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)