exercism / exercism/elixir-representer
Normalize struct names
- Lingua principale
- Elixir
- Stelle
- 11
- Fork
- 8
- Merge medio
- 11g 3h
- PR unite (30g)
- 1
Descrizione
This is mentioned in #29.
Struct names should be replaced by placeholders as well.
## Example input
```elixir
defmodule Something do
defstruct [:a, :b]
def something(%Something{a: a}), do: %Something{a: 2 * a}
def something_else(%__MODULE__{a: a}), do: %__MODULE__{a: 3 * a}
end
```
## Desired output
```elixir
defmodule(PLACEHOLDER_1) do
defstruct([:a, :b])
def(PLACEHOLDER_2(%PLACEHOLDER_1{a: PLACEHOLDER_3})) do
%PLACEHOLDER_1{a: 2 * PLACEHOLDER_3}
end
def(PLACEHOLDER_4(%__MODULE__{a: PLACEHOLDER_3})) do
%__MODULE__{a: 3 * PLACEHOLDER_3}
end
end
```
I think `__MODULE__` should not be replaced, because it means different things in different modules. It's already normalized, in a way...
## Current output
```elixir
defmodule(PLACEHOLDER_1) do
defstruct([:a, :b])
def(PLACEHOLDER_2(%Something{a: PLACEHOLDER_3})) do
%Something{a: 2 * PLACEHOLDER_3}
end
def(PLACEHOLDER_4(%__MODULE__{a: PLACEHOLDER_3})) do
%__MODULE__{a: 3 * PLACEHOLDER_3}
end
end
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.