T
Tom Cloyd
I'm making no progress on this, and so clearly have missed something basic.
I have a class which requires a file containing module Utils_db. There
is another module 'required' in the program which instantiates this class.
I then successfully access in the class two constants - one from each
module.
Utils::MENU
Utils_db::MENU
Now the trouble starts.
Right after accessing the constants, I try to call a method in one of
the modules -
eval("Utils.orph_chk") <= I will be replacing the string with a
construction using a variable, in the final version
This always fails. I've tried every trick I can think of, but always I
get this:
../lib/setnet/SN.rb:579:in `proc_command': undefined method `orph_chk'
for Utils:Module (NoMethodError)
from ../lib/setnet/SN.rb:229:in `eval'
from ../lib/setnet/SN.rb:579:in `proc_command'
from ../lib/setnet/SN.rb:229:in `user_interface'
from ../lib/setnet/SN.rb:146:in `manage'
from ../lib/setnet/SN.rb:68:in `startup'
from ./setnet:28
Can someone suggest why I'm not able to get to this method?
Here's the relevant Module, in abbreviated form:
module Utils
MENU = [
["orph_chk", "searches nodes and links for references which cannot be
resolved, and reports them"],
["tree_count","starting with node 'root', locates descendants of each
node, displaying count at each level"],
["showtree","starting with node 'root', locates and displays
descendants of each node"],
["tree_orphans","locates links which cannot be traced to the root
node, and displays them"]
]
def orph_chk
puts 'orph_chk'
end
end
Any suggestions would be much appreciated. I cannot quite figure out
what to try next.
Thanks,
Tom
I have a class which requires a file containing module Utils_db. There
is another module 'required' in the program which instantiates this class.
I then successfully access in the class two constants - one from each
module.
Utils::MENU
Utils_db::MENU
Now the trouble starts.
Right after accessing the constants, I try to call a method in one of
the modules -
eval("Utils.orph_chk") <= I will be replacing the string with a
construction using a variable, in the final version
This always fails. I've tried every trick I can think of, but always I
get this:
../lib/setnet/SN.rb:579:in `proc_command': undefined method `orph_chk'
for Utils:Module (NoMethodError)
from ../lib/setnet/SN.rb:229:in `eval'
from ../lib/setnet/SN.rb:579:in `proc_command'
from ../lib/setnet/SN.rb:229:in `user_interface'
from ../lib/setnet/SN.rb:146:in `manage'
from ../lib/setnet/SN.rb:68:in `startup'
from ./setnet:28
Can someone suggest why I'm not able to get to this method?
Here's the relevant Module, in abbreviated form:
module Utils
MENU = [
["orph_chk", "searches nodes and links for references which cannot be
resolved, and reports them"],
["tree_count","starting with node 'root', locates descendants of each
node, displaying count at each level"],
["showtree","starting with node 'root', locates and displays
descendants of each node"],
["tree_orphans","locates links which cannot be traced to the root
node, and displays them"]
]
def orph_chk
puts 'orph_chk'
end
end
Any suggestions would be much appreciated. I cannot quite figure out
what to try next.
Thanks,
Tom