thinkerbot / tap

A framework for creating configurable, distributable tasks and workflows.
http://tap.rubyforge.org
20 stars 0 forks source link

Configurable using instance_variable_defined? not supported on older (1.8.5) installations #10

Closed jtprince closed 15 years ago

jtprince commented 15 years ago

Tap depends on configurable and configurable calls instance_variable_defined? However, this method doesn't exist in ruby 1.8.5. Wondering if there is a workaround or fix (I'd upgrade ruby but these machines are out of my control).

/home/jtprince/.gems/gems/configurable-0.5.0/lib/configurable/module_methods.rb:11:in `included': undefined method `instance_variable_defined?' for Tap::App:Class (NoMethodError)
from /home/jtprince/.gems/gems/tap-0.18.0/lib/tap/app.rb:111:in `include'
from /home/jtprince/.gems/gems/tap-0.18.0/lib/tap/app.rb:111
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/jtprince/.gems/gems/tap-0.18.0/lib/tap/join.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/jtprince/.gems/gems/tap-0.18.0/lib/tap/joins.rb:1
 ... 8 levels...
from /home/jtprince/dev/ms-sequest/lib/ms/sequest/srf.rb:17
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ../../plot_cys_scores.rb:3

Thanks :)

thinkerbot commented 15 years ago

Hey, sorry for the delay. I use instance_variable_defined to allow an including class to use predefined variables. This can be useful if a class includes several configurable modules... I'm not sure I can take it out and I don't know of a good workaround.

One of the reasons I check if the instance variable is defined is both because that method allows nils and false (as '@var ||=' would not), and because it prevents warnings that arise when you use an uninitialized variable.

I'm open to suggestions but honestly using an older version of ruby may be sketchy with Configurable period. It's just never been developed there. Anyhow, I'm closing this issue for now, but if you discover something new then feel free to re-open it.