lib/hamster/immutable.rb in hamster-1.0.1.pre.rc2 vs lib/hamster/immutable.rb in hamster-1.0.1.pre.rc3
- old
+ new
@@ -1,14 +1,16 @@
module Hamster
+ # @private
module Immutable
def self.included(klass)
klass.extend(ClassMethods)
klass.instance_eval do
include InstanceMethods
end
end
+ # @private
module ClassMethods
def new(*args)
super.immutable!
end
@@ -28,16 +30,18 @@
METHOD
end
end
end
+ # @private
module MemoizeMethods
def immutable!
@__hamster_immutable_memory__ = Object.new
freeze
end
end
+ # @private
module InstanceMethods
def immutable!
freeze
end