Why does the following method return nil?
def foo
info = " What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
"
result = Hash.new
info.each do |line|
if line.scan(/\|/)
field, oldVal, newVal = line.chomp.split(/\s*\|\s*/)
if (field == 'Status')
result['status'] = newVal
end
end
end
result
end
Also, for some reason the statement "if (field == 'Status')" doesn't
return true.
Thanks,
Andy.
--
Posted via http://www.ruby-forum.com/.