Skip to content

Instantly share code, notes, and snippets.

@jaydorsey
Created August 16, 2024 13:30
Show Gist options
  • Save jaydorsey/33b99249e1358feb00d6035acc8bc213 to your computer and use it in GitHub Desktop.
Save jaydorsey/33b99249e1358feb00d6035acc8bc213 to your computer and use it in GitHub Desktop.
unexpected '\n', expecting =>

Ruby is expecting a Hash, but you forgot something (maybe a key name?)

Example:

# wrong
foo: { # Start of the new hash
  :bar # You're missing your key OR value
}

Either of these would work. The ruby error message says expecting => because your key/value pair in the hash is missing a key or a value, and => is the older hash rocket syntax.

# right
foo: {
  bar: :blah
}
# also right
foo: {
  :bar => :blah
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment