Merge pull request #220 from laSinteZ/master
chore: removed trailing whitespaces, added newline
This commit is contained in:
@@ -40,7 +40,7 @@ $ mix meditate --no-clear-screen
|
|||||||
|
|
||||||
If you want to jump to a specific lesson, run it with `--koan=<koan name>`
|
If you want to jump to a specific lesson, run it with `--koan=<koan name>`
|
||||||
```sh
|
```sh
|
||||||
$ mix meditate --koan=PatternMatching
|
$ mix meditate --koan=PatternMatching
|
||||||
```
|
```
|
||||||
|
|
||||||
Any typos on the koan name will show the complete list of koans, where you can pick any.
|
Any typos on the koan name will show the complete list of koans, where you can pick any.
|
||||||
|
|||||||
@@ -36,4 +36,3 @@ defmodule Sigils do
|
|||||||
assert ~W(Hello #{1+1}) == ___
|
assert ~W(Hello #{1+1}) == ___
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ defmodule GenServers do
|
|||||||
|
|
||||||
####
|
####
|
||||||
# GenServer implementation
|
# GenServer implementation
|
||||||
|
|
||||||
def handle_call(:get_password, _from, current_password) do
|
def handle_call(:get_password, _from, current_password) do
|
||||||
{:reply, current_password, current_password}
|
{:reply, current_password, current_password}
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_call(:get_manufacturer, _from, current_state) do
|
def handle_call(:get_manufacturer, _from, current_state) do
|
||||||
@@ -68,22 +68,22 @@ defmodule GenServers do
|
|||||||
def handle_call(:name_check, _from, current_state) do
|
def handle_call(:name_check, _from, current_state) do
|
||||||
{:reply, "Congrats! Your process was successfully named.", current_state}
|
{:reply, "Congrats! Your process was successfully named.", current_state}
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_call({:unlock, password}, _from, current_password) do
|
def handle_call({:unlock, password}, _from, current_password) do
|
||||||
case password do
|
case password do
|
||||||
password when password === current_password ->
|
password when password === current_password ->
|
||||||
{:reply, {:ok, "Laptop unlocked!"}, current_password}
|
{:reply, {:ok, "Laptop unlocked!"}, current_password}
|
||||||
_ ->
|
_ ->
|
||||||
{:reply, {:error, "Incorrect password!"}, current_password}
|
{:reply, {:error, "Incorrect password!"}, current_password}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_cast({:change_password, old_password, new_password}, current_password) do
|
def handle_cast({:change_password, old_password, new_password}, current_password) do
|
||||||
case old_password do
|
case old_password do
|
||||||
old_password when old_password == current_password ->
|
old_password when old_password == current_password ->
|
||||||
{:noreply, new_password}
|
{:noreply, new_password}
|
||||||
_ ->
|
_ ->
|
||||||
{:noreply, current_password}
|
{:noreply, current_password}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -147,7 +147,7 @@ defmodule GenServers do
|
|||||||
{_, response} = Laptop.unlock("EL!73")
|
{_, response} = Laptop.unlock("EL!73")
|
||||||
assert response == ___
|
assert response == ___
|
||||||
|
|
||||||
{_, response} = Laptop.owner_name
|
{_, response} = Laptop.owner_name
|
||||||
assert response == ___
|
assert response == ___
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user