Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
arathunku committed Mar 23, 2024
1 parent 44848cc commit 3b05efe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
7 changes: 6 additions & 1 deletion lib/ext_fit/field.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ defmodule ExtFit.Field do
Returns field's name. If field is known it will return its atom name, if field is unknown
it returns `"unknown_\#{num}"`.
"""
@type field :: ExtFit.Types.Subfield.t() | ExtFit.Types.Field.t() | ExtFit.Types.FieldData.t() | ExtFit.Types.FieldDefinition.t() | ExtFit.Types.DevFieldDefinition.t()
@type field ::
ExtFit.Types.Subfield.t()
| ExtFit.Types.Field.t()
| ExtFit.Types.FieldData.t()
| ExtFit.Types.FieldDefinition.t()
| ExtFit.Types.DevFieldDefinition.t()

@spec name(field) :: atom() | String.t()
def name(%{field: %{name: name}} = _field), do: name
Expand Down
30 changes: 15 additions & 15 deletions lib/ext_fit/profile.ex
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,21 @@ defmodule ExtFit.Profile do
defstruct num: @num, name: @name, fields: @fields

@fields_table_doc @fields
|> Enum.sort_by(fn {_, %{num: num}} -> num end)
|> Enum.map(fn {name, field} ->
[
"| " <> to_string(name),
field.type.name,
field.num,
field.scale,
field.offset,
field.units,
to_string(field.array) <> " |"
]
|> Enum.map(&(&1 || ""))
|> Enum.join(" | ")
end)
|> Enum.join("\n")
|> Enum.sort_by(fn {_, %{num: num}} -> num end)
|> Enum.map(fn {name, field} ->
[
"| " <> to_string(name),
field.type.name,
field.num,
field.scale,
field.offset,
field.units,
to_string(field.array) <> " |"
]
|> Enum.map(&(&1 || ""))
|> Enum.join(" | ")
end)
|> Enum.join("\n")
@moduledoc """
Message: `:#{@name}` identified by num=#{@num}
Expand Down
2 changes: 1 addition & 1 deletion lib/ext_fit/types.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule ExtFit.Types.DevField do
native_field_num: non_neg_integer(),
dev_data_index: non_neg_integer(),
units: nil | String.t(),
type: ExtFit.Types.BaseType.t(),
type: ExtFit.Types.BaseType.t()
}
end

Expand Down

0 comments on commit 3b05efe

Please sign in to comment.