Skip to content

Accept binaries for Unix-like paths#93

Merged
dumbbell merged 1 commit into
mainfrom
accept-binary-for-unix-path
May 2, 2022
Merged

Accept binaries for Unix-like paths#93
dumbbell merged 1 commit into
mainfrom
accept-binary-for-unix-path

Conversation

@dumbbell

@dumbbell dumbbell commented May 2, 2022

Copy link
Copy Markdown
Collaborator

This is especially handy for Beam languages which use Erlang binaries to implement strings, such as Elixir or Gleam.

To achieve that, khepri_path:from_string/1 is expanded to accept Erlang binaries. The implementation is very basic: the binary is converted to a list.

We also introduce from_binary/1 which just calls from_string/1. So they both accept all representations of paths. from_binary/1 is for convenience and to make it clear that Erlang binaries are accepted.

to_string/1 will always return an Erlang string however. To produce a binary, there is now to_binary/1.

Fixes #92.

@dumbbell dumbbell added the enhancement New feature or request label May 2, 2022
@dumbbell dumbbell self-assigned this May 2, 2022
@dumbbell
dumbbell force-pushed the accept-binary-for-unix-path branch 2 times, most recently from 9d4be44 to e1fff67 Compare May 2, 2022 12:02
This is especially handy for Beam languages which use Erlang binaries to
implement strings, such as Elixir or Gleam.

To achieve that, `khepri_path:from_string/1` is expanded to accept
Erlang binaries. The implementation is very basic: the binary is
converted to a list.

We also introduce `from_binary/1` which just calls `from_string/1`. So
they both accept all representations of paths. `from_binary/1` is for
convenience and to make it clear that Erlang binaries are accepted.

`to_string/1` will always return an Erlang string however. To produce a
binary, there is now `to_binary/1`.

Fixes #92.
@dumbbell
dumbbell force-pushed the accept-binary-for-unix-path branch from e1fff67 to 05b21d1 Compare May 2, 2022 12:05
@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 586

  • 0 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.6%) to 85.619%

Totals Coverage Status
Change from base Build 576: -1.6%
Covered Lines: 1917
Relevant Lines: 2239

💛 - Coveralls

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 586

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.6%) to 85.619%

Totals Coverage Status
Change from base Build 576: -1.6%
Covered Lines: 1917
Relevant Lines: 2239

💛 - Coveralls

@dumbbell
dumbbell marked this pull request as ready for review May 2, 2022 12:12
@dumbbell
dumbbell merged commit 0b31c7f into main May 2, 2022
@dumbbell
dumbbell deleted the accept-binary-for-unix-path branch May 2, 2022 12:14
@dumbbell dumbbell added this to the v0.4.0 milestone Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept binaries as Unix-like paths

2 participants