Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Andrea Leopardi <[email protected]>
  • Loading branch information
josevalim and whatyouhide authored Sep 11, 2023
1 parent d64185e commit 60a1282
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/elixir/pages/anti-patterns/design-anti-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,14 @@ An example of this anti-pattern, as shown below, is when a function has many alt

```elixir
defmodule AlternativeInteger do
@spec parse(String.t(), keyword()) :: integer() | {integer(), String.t()} | :error
def parse(string, options \\ []) when is_list(options) do
if Keyword.get(options, :discard_rest, false) do
String.to_integer(string)
else
Integer.parse(string)
end
end

def parse(string, opts \\ :default) do
case opts do
:default -> Integer.parse(string)
end
end
end
```

Expand Down

0 comments on commit 60a1282

Please sign in to comment.