Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
object.freeze! freezes all sub-objects in an Array or Hash
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
README
Rakefile
mr_freeze.gemspec

README

mr_freeze
=========

Real name: Dr Victor Fries

Description
===========

Freeze arrays, hashes, and their contents

Example
=======

    gem install mr_freeze
    
    # without mr_freeze
    hash = {"some" => "hash"}.freeze
    hash["some"].sub!(/h/, "b")
    
    # => uh oh... we've changed the string in place
    
    # load mr_freeze
    require 'rubygems'
    require 'mr_freeze'
    
    # with mr_freeze
    hash = {"victor" => "fries"}.freeze!
    hash["victor"].sub!(/f/, "c")
    
    # => TypeError: can't modify frozen string
Something went wrong with that request. Please try again.