Skip to content

Instantly share code, notes, and snippets.

@agrimm
Created March 2, 2014 01:14
Show Gist options
  • Save agrimm/9300399 to your computer and use it in GitHub Desktop.
Save agrimm/9300399 to your computer and use it in GitHub Desktop.
# Simplified version of the bug LiteralInCondition detected in my code
def parse_string(string)
case
when string =~ /foo/ then foo
when string =~ /bar/ then bar
when ["a", "b", "c"].include?(string) then baz
# goto fail. Go directly to fail. Do not pass go, do not collect $200.
when /something_else/ then something_else
else fail
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment