Women in Technology

Hear us Roar

  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?

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Problems with complete script
    2004-08-01 04:02:11  m_keightley [View]

    Okay, donkey of the day award goes to me. I've now spotted what the problem was. The problem is on this line is to_s
    It should read
    Note the @ before commandName, showing it to be an instance variable, according to part 1.
    Hope this helps other newbies out there.
    • Problems with complete script
      2004-08-01 10:27:50  Christopher Roach | O'Reilly Blogger [View]

      Oops, that was a typo on my part. Thanks for pointing that out for the other readers.