The key is symbol in your first piece of code, and you have to return test
at last in your second piece of code.
def attributes
test = {}
test[:city] = @content[1..20].strip
test[:streetname] = @content[21..40].strip
test[:house_number] = @content[41..46].strip.to_i
test
end