项目作者: PeterCamilleri

项目描述 :
A deep, recursive freeze and freeze tester in pure Ruby.
高级语言: Ruby
项目地址: git://github.com/PeterCamilleri/fully_freeze.git
创建时间: 2019-01-21T17:18:29Z
项目社区:https://github.com/PeterCamilleri/fully_freeze

开源协议:MIT License

下载


FullyFreeze

This gem is created in recognition of two hot topics in Ruby programming.

Namely:

  • Multi-threaded programming with guilds.
  • Functional programming.

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!

Installation

Add this line to your application’s Gemfile:

  1. gem 'fully_freeze'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install fully_freeze

Usage

  1. require 'fully_freeze'

Then when a deep freeze is needed use:

  1. foo = my_object.fully_freeze

and to determine if that data is really immutable, use:

  1. if my_object.fully_frozen?
  2. # etc etc etc...
  3. 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.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

OR…

  • Make a suggestion by raising an
    issue
    . All ideas and comments are welcome.

License

The gem is available as open source under the terms of the
MIT License.

Code of Conduct

Everyone interacting in the fully_freeze project’s codebases, issue trackers,
chat rooms and mailing lists is expected to follow the
code of conduct.