atomic_map icon indicating copy to clipboard operation
atomic_map copied to clipboard

Atomic map custom replacement

Open todotentei opened this issue 6 years ago • 1 comments

And here I want to add a feature on top of underscore. I added a macro called replace/2 - replace(regex, replacement) into the module AtomicMap.Base.

Use case:

defmodule Test do
  use AtomicMap.Base, safe: false

  replace ~r/~/, "_"
end

iex(1)> Test.convert %{"a~b" => 1}
%{a_b: 1}

todotentei avatar Sep 07 '18 15:09 todotentei

Thanks a lot! I'm currently on holidays, will take a look in 2 weeks.

On Fri, Sep 7, 2018, 5:49 PM Virayatta Te [email protected] wrote:

And here I want to add a feature on top of underscore. I added a macro called replace/2 - replace(regex, replacement) into the module AtomicMap.Base.

Use case:

defmodule Test do use AtomicMap.Base, safe: false

replace ~r/~/, "_"end

iex(1)> Test.convert %{"a~b" => 1} %{a_b: 1}


You can view, comment on, or merge this pull request online at:

https://github.com/ruby2elixir/atomic_map/pull/17 Commit Summary

  • AtomicMap Base
  • Protocol
  • Small Fix: struct impl
  • Regex Custom Replacement

File Changes

Patch Links:

  • https://github.com/ruby2elixir/atomic_map/pull/17.patch
  • https://github.com/ruby2elixir/atomic_map/pull/17.diff

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ruby2elixir/atomic_map/pull/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAE0DbcY3WaP-EsM65et7DhoBNHrtYzks5uYpV3gaJpZM4WfETd .

mindreframer avatar Sep 07 '18 17:09 mindreframer