module Erlang::Immutable::ClassMethods
@private
Public Instance Methods
memoize(*names)
click to toggle source
# File lib/erlang/immutable.rb, line 43 def memoize(*names) include MemoizeMethods unless include?(MemoizeMethods) names.each do |name| original_method = "__erlang_immutable_#{name}__" alias_method original_method, name class_eval <<-METHOD, __FILE__, __LINE__ def #{name} if @__erlang_immutable_memory__.instance_variable_defined?(:@#{name}) @__erlang_immutable_memory__.instance_variable_get(:@#{name}) else @__erlang_immutable_memory__.instance_variable_set(:@#{name}, #{original_method}) end end METHOD end end
new(*args)
click to toggle source
Calls superclass method
# File lib/erlang/immutable.rb, line 39 def new(*args) super.__send__(:immutable!) end