A deep, recursive freeze and freeze tester in pure Ruby.
This gem is created in recognition of two hot topics in Ruby programming.
Namely:
While these topics are outside the scope of this gem, both are facilitated by
the concept of treating data as immutable, pure values.
While many data types in Ruby are immutable, many are not. Further, while the
freeze method is provided to make data immutable, and the frozen? method can be
used to determine if data is immutable, neither of these methods digs down into
the interior of the object to make those data immutable as well.
The fully_freeze gem does not take such half measures. Instead it digs deep
into the objects and gets the job done!
Add this line to your application’s Gemfile:
gem 'fully_freeze'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fully_freeze
require 'fully_freeze'
Then when a deep freeze is needed use:
foo = my_object.fully_freeze
and to determine if that data is really immutable, use:
if my_object.fully_frozen?
# etc etc etc...
end
And that is all there is too it!
Note: While this gem does employ monkey-patching, no existing methods are
modified, so the risk level is low.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)OR…
The gem is available as open source under the terms of the
MIT License.
Everyone interacting in the fully_freeze project’s codebases, issue trackers,
chat rooms and mailing lists is expected to follow the
code of conduct.