dry-rb / dry-container

A simple, configurable object container implemented in Ruby
https://dry-rb.org/gems/dry-container
MIT License
335 stars 41 forks source link

Freeze a Container? #51

Closed fnordfish closed 6 years ago

fnordfish commented 6 years ago

I'd like to be able to freeze a container after it is set up, so that it won't accept new keys anymore.

Right now, this works:

MyContainer._container.freeze
MyContainer.register("test", "bail")

FrozenError (can't modify frozen Concurrent::Hash)

But as the comment says, _container is pretty private.

Is the above usage ok, or should the be a new feature?