When I run ruby with the -w (which is my habit) and a template includes an [%in%] directive that does not include a :name option, I get this warning:
/usr/local/lib/ruby/site_ruby/1.8/PageTemplate/commands.rb:453: warning: instance variable @iterators not initialized
The code in question in commands.rb is:
# Print the output of all the objects joined together.
case
when @iterators.nil? || @iterators.empty?
When I look at initialize, it seems as though @iterators is initialized only sometimes:
def initialize(called_as, value, iterators)
@called_as = called_as
@value = value
@iterators = iterators.strip.gsub(/\s+/,' ').split if iterators
@switched = false
@commands = BlockCommand.new
@elseCommands = BlockCommand.new
@in_else = false
end
Perhaps the @iterators intialization should be something like this?
@iterators = iterators ? iterators.strip.gsub(/\s+/,' ').split : nil
I don't know if that change is correct, but it makes the warning go away, and my scripts still seem to work.
|