atomic_map
atomic_map copied to clipboard
Atomic map custom replacement
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}
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
- A bench/snapshots/2018-09-07_22-57-47.snapshot https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-0 (6)
- A bench/snapshots/2018-09-07_22-58-15.snapshot https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-1 (6)
- M lib/atomic_map.ex https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-2 (67)
- A lib/atomic_map/base.ex https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-3 (51)
- A lib/atomic_map/converters.ex https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-4 (55)
- A lib/atomic_map/key.ex https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-5 (62)
- A lib/atomic_map/opts.ex https://github.com/ruby2elixir/atomic_map/pull/17/files#diff-6 (8)
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 .