Robert - Thanks for taking a look!

Maybe I should have used my actual code instead of trying to write up an 
example. The lack of end on my if in the example wasn't the issue. 
Here's the actual block with content sanitized.

Where xmldoc is a REXML object I'm using without problem elsewhere in 
this code.

The IF line below is where I hit the problems

types = ["foo", "bar", "stuff", "other", "favorite"]
conditions = ["up", "down", "marginal"]


types.each { |@scan_type|
  conditions.each { |@scan_conditions|
   if xmldoc.elements[@scan_type].attributes[@scan_conditions]
    count_to_add = 
site.elements[@scan_type].attributes[@scan_conditions].to_i
    addtodb(siteToSave.id, scan_type, scan_conditions,count_to_add)
   end
  }
}





Robert Klemme wrote:
> 2009/8/25 Nick Wild <nickwild / gmail.com>:
>>
>>
>>
>> same error
>>
>> I don't understand why I can use the string directly but when I try
>> indirectly it's hitting this error and why I'm getting a nil error when
>> I'm trying to use the if to check if the object is not nil.
>>
>> I'm still really baffled by certain things in ruby. Thanks in advance
>> for any tips or pointers. I'm sorry for the newbie question but this is
>> one of those dig through google and books and still come up ready to
>> pull your hair out little niggling things.
> 
> Look at your line that starts with "puts" - it's just a silly copy and
> paste error. :-)
> 
> Note: if you need to access a single object multiple times in the
> block, it is more efficient and probably also more readable to just
> pull it once.
> 
> Cheers
> 
> robert

-- 
Posted via http://www.ruby-forum.com/.