Article:
 |
|
Ruby/Tk Primer, Part 3
|
| Subject: |
|
Problems with complete script |
| Date: |
|
2004-08-01 03:55:02 |
| From: |
|
m_keightley
|
|
|
I'm having some problems with the complete script as shown in parts 1 and 3. I get the follow error
Ruby# ./CronJobMgr.rb:74:in `commandName': private method `split' called for nil:NilClass (NoMethodError)
from ./CronJobMgr.rb:96:in `to_s'
from /usr/local/lib/ruby/1.8/tk.rb:295:in `_get_eval_string'
from /usr/local/lib/ruby/1.8/tk.rb:312:in `ruby2tcl'
from /usr/local/lib/ruby/1.8/tk.rb:1021:in `tk_call'
from /usr/local/lib/ruby/1.8/tk.rb:1021:in `collect!'
from /usr/local/lib/ruby/1.8/tk.rb:1021:in `tk_call'
from /usr/local/lib/ruby/1.8/tk.rb:3775:in `tk_send'
from /usr/local/lib/ruby/1.8/tk.rb:5219:in `insert'
from CronManager.rb:244:in `initialize'
from CronManager.rb:243:in `each'
from CronManager.rb:243:in `initialize'
from CronManager.rb:344:in `new'
from CronManager.rb:344
This suggests the problem lays in the to_s method, which I've proved by removing the \t\t#{commandName} bit which then enables the script to run with out error. I've copied and pasted the script, so I sure it's not my rather poor typing! Any ideas?
|
Showing messages 1 through 2 of 2.
-
Problems with complete script
2004-08-01 04:02:11
m_keightley
[View]
"#{@weekday}\t\t#{commandName}"It should read
"#{@weekday}\t\t#{@commandName}"Note the @ before commandName, showing it to be an instance variable, according to part 1.
Hope this helps other newbies out there.