Demonstrate put_in using atoms to manipulate nested values of a nested
Map
This commit is contained in:
@@ -59,4 +59,14 @@ defmodule Structs do
|
||||
airline = %Airline{plane: %Plane{maker: :boeing, passengers: 200}}
|
||||
assert update_in(airline.plane.passengers, &(&1 + 2)) == ___
|
||||
end
|
||||
|
||||
koan "Use the put_in macro with atoms to replace a nested value in a non-struct" do
|
||||
airline = %{
|
||||
plane: %{
|
||||
maker: :boeing
|
||||
},
|
||||
name: "Southwest"
|
||||
}
|
||||
assert put_in(airline[:plane][:maker], :cessna) == ___
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user