T
Tom Cloyd
I'm baffled by this error, after a hour+ of experimentation with
solutions. I assume it's a compiler error (right term in Ruby?), as I'm
not even getting access to ruby-debug.
Code snippet:
=======
def main
opdb = Open_db.new( [1,2,3] )
end
class Open_db
def initialize( dblist )
@dbs = dblist
end
@dbs.each do |cnt| # <= line producing the error
db_lbl = cnt[0]
db_nm = cnt[1]
end
end
%w(rubygems ruby-debug readline strscan logger fileutils).each{ |lib|
require lib }
Debugger.start
debugger # call to ruby-debug
main # ...initiate execution (at this point all dependencies are resolved)
# end file
=========
Error msg: setnet-xa.rb:12: undefined method `each' for nil:NilClass
(NoMethodError)
It appears that @dbs is not getting initialized, but I cannot why not.
Any help would be much appreciated!
Tom
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< (e-mail address removed) >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solutions. I assume it's a compiler error (right term in Ruby?), as I'm
not even getting access to ruby-debug.
Code snippet:
=======
def main
opdb = Open_db.new( [1,2,3] )
end
class Open_db
def initialize( dblist )
@dbs = dblist
end
@dbs.each do |cnt| # <= line producing the error
db_lbl = cnt[0]
db_nm = cnt[1]
end
end
%w(rubygems ruby-debug readline strscan logger fileutils).each{ |lib|
require lib }
Debugger.start
debugger # call to ruby-debug
main # ...initiate execution (at this point all dependencies are resolved)
# end file
=========
Error msg: setnet-xa.rb:12: undefined method `each' for nil:NilClass
(NoMethodError)
It appears that @dbs is not getting initialized, but I cannot why not.
Any help would be much appreciated!
Tom
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< (e-mail address removed) >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~