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

Adding ExHal.Interpreter module to define mappers in applications #24

Merged
merged 2 commits into from
Apr 8, 2016

Conversation

alakra
Copy link
Contributor

@alakra alakra commented Apr 8, 2016

defmodule MyInterpreter do
  use ExHal.Intepreter

  defextract :first_name
  defextract :last_name
end

This would create a to_params/1 function on MyInterpreter that
would be called with an ExHal.Document:

  iex(1)> MyInterpreter.to_params(doc)
  => %{first_name: ..., last_name: ...}

If the ExHal.Document does not have a property , it will default that
particular parameter to nil

Angelo Lakra added 2 commits April 8, 2016 13:25
```elixir
defmodule MyInterpreter do
  use ExHal.Intepreter

  defextract :first_name
  defextract :last_name
end
```

This would create a `to_params/1` function on `MyInterpreter` that
would be called with an ExHal.Document:

```elixir
  iex(1)> MyInterpreter.to_params(doc)
  => %{first_name: ..., last_name: ...}
```

If the ExHal.Document does not have a property , it will default that
particular parameter to `nil`
@pezra pezra merged commit 7f10aad into pezra:master Apr 8, 2016
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

Successfully merging this pull request may close these issues.

2 participants