Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in readme example #26

Open
joaothallis opened this issue May 31, 2019 · 0 comments
Open

Error in readme example #26

joaothallis opened this issue May 31, 2019 · 0 comments

Comments

@joaothallis
Copy link

This:

/app # iex -S mix
Erlang/OTP 21 [erts-10.3.5.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> defmodule TestStruct do
...(1)>   defstruct field_one: nil,
...(1)>             field_two: nil,
...(1)>             field_three: nil,
...(1)>             field_four: nil
...(1)>   use ExConstructor
...(1)> end
{:module, TestStruct,
 <<70, 79, 82, 49, 0, 0, 7, 224, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 249,
   0, 0, 0, 23, 17, 69, 108, 105, 120, 105, 114, 46, 84, 101, 115, 116, 83, 116,
   114, 117, 99, 116, 8, 95, 95, 105, 110, ...>>, :ok}
iex(2)> 
nil
iex(3)> TestStruct.new(%{"field_one" => "a", "fieldTwo" => "b", :field_three => "c", :FieldFour => "d"})
%TestStruct{field_four: nil, field_one: "a", field_three: "c", field_two: "b"}

Expect: %TestStruct{field_one: "a", field_two: "b", field_three: "c", field_four: "d"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant