Skip to content
New issue

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

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

Already on GitHub? # to your account

add parentheses to module metadata function calls #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/remodel/formatters/list_formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ defmodule Remodel.Formatter.ListFormatter do
do: Enum.map(resources, fn(resource) -> format_resources(resource, serializer, options) end)

defp format_resources(resource, serializer, options) do
Enum.map serializer.__attributes, fn(attr) ->
Enum.map(serializer.__attributes(), fn(attr) ->
if !attr.if || apply(serializer, attr.if, [resource, options[:scope]]) do
apply(serializer, attr.attribute, [resource, options[:scope]])
else
nil
end
end
end)
end

defp format_header(serializer),
do: Enum.map(serializer.__attributes, fn(attr) -> to_string(attr.as || attr.attribute) end)
do: Enum.map(serializer.__attributes(), fn(attr) -> to_string(attr.as || attr.attribute) end)
end
2 changes: 1 addition & 1 deletion lib/remodel/formatters/map_formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Remodel.Formatter.MapFormatter do
end

defp format_resource(resource, serializer, options) when is_map(resource) do
Enum.reduce(serializer.__attributes, %{}, fn(attr, results) ->
Enum.reduce(serializer.__attributes(), %{}, fn(attr, results) ->
if !attr.if || evaluate_conditional(resource, serializer, options, attr) do
Map.put(results, attr.as || attr.attribute, apply(serializer, attr.attribute, [resource, options[:scope]]))
else
Expand Down