`next if ... || if ..` seems.... like a typo? Did you mean:

`next if typename.nil? || typename[0,1] == "#"` ?