carturoch/ex_uc

Units not available when deployed

Closed this issue · 1 comments

Hello,

The default units are not available when the application is deployed (for instance with distillery).

%ExUc.Value{value: value} = ExUc.to(%{value: 1, unit: :m, kind: :length}, :km)
** (ArgumentError) argument error
    :erlang.binary_to_atom(nil, :utf8)
    (ex_uc) lib/units.ex:325: ExUc.Units.get_conversion/2
    (ex_uc) lib/ex_uc.ex:100: ExUc.to/2

ExUc.Units.map() only returns the custom units.

I think it somehow related to the way the units are loaded :

# units.ex:51
  def all do
    units_modules = Path.absname("units/*.ex", __DIR__)

It should be great to add a warning in the README, while it's not fixed :)

That's very interesting. Small refactor is on its way. Thanks a lot for pointing this out!