module Multiton::Mixin
Mixin
adds appropriate behavior to multiton instances.
Public Instance Methods
_dump(_level) → string
click to toggle source
Serializes the instance as a string that can be reconstituted at a later point. The parameter _level
is not used, but it is needed for marshalling to work correctly.
Returns a string representing the serialized multiton instance.
# File lib/multiton/mixin.rb, line 13 def _dump(_level) self.class.instance_variable_get(:@__multiton_instances).key self end
clone
click to toggle source
Raises a TypeError since multiton instances can not be cloned.
Never returns.
# File lib/multiton/mixin.rb, line 24 def clone raise TypeError, "can't clone instance of multiton `#{self.class.name}`" end
dup
click to toggle source
Raises a TypeError since multiton instances can not be duplicated.
Never returns.
# File lib/multiton/mixin.rb, line 35 def dup raise TypeError, "can't dup instance of multiton `#{self.class.name}`" end