Permalink
Browse files

Replace Object#freeze with IceNine.deep_freeze

  • Loading branch information...
dkubb committed Aug 6, 2012
1 parent 4a4b7dd commit bb71b3dfb09693c82a4ee2e77adf051114249bf8
Showing with 7 additions and 3 deletions.
  1. +1 −0 .rvmrc
  2. +1 −0 Gemfile
  3. +4 −2 lib/immutable.rb
  4. +1 −1 spec/unit/immutable/module_methods/memoize_spec.rb
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use @$(basename `pwd`) --create
View
@@ -3,6 +3,7 @@
source 'https://rubygems.org'
gem 'backports', '~> 2.6.1'
+gem 'ice_nine', '~> 0.4.0'
group :development do
gem 'jeweler', '~> 1.8.3'
View
@@ -1,3 +1,5 @@
+require 'ice_nine'
+
# Allows objects to be made immutable
module Immutable
@@ -53,7 +55,7 @@ def self.freeze_object(object)
#
# @api private
def self.freeze_value(value)
- value.frozen? ? value : value.dup.freeze
+ value.frozen? ? value : IceNine.deep_freeze(value.dup)
end
private_class_method :freeze_value
@@ -240,7 +242,7 @@ module ClassMethods
#
# @api public
def new(*)
- super.freeze
+ IceNine.deep_freeze(super)
end
end # module ClassMethods
@@ -19,7 +19,7 @@
subject
file, line = object.new.send(method).first.split(':')[0, 2]
File.expand_path(file).should eql(File.expand_path('../../../../../lib/immutable.rb', __FILE__))
- line.to_i.should eql(209)
+ line.to_i.should eql(211)
end
it 'sets the file and line number properly' do

0 comments on commit bb71b3d

Please sign in to comment.