Module: Multiton::Mixin
- Defined in:
- lib/multiton/mixin.rb
Overview
Mixin adds appropriate behavior to multiton instances.
Instance Method Summary collapse
-
#_dump(_level) ⇒ Object
call-seq: _dump(_level) => string.
-
#clone ⇒ Object
call-seq: clone.
-
#dup ⇒ Object
call-seq: dup.
Instance Method Details
#_dump(_level) ⇒ Object
call-seq:
_dump(_level) => string
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.
13 14 15 |
# File 'lib/multiton/mixin.rb', line 13 def _dump(_level) self.class.instance_variable_get(:@__multiton_instances).key self end |
#clone ⇒ Object
24 25 26 |
# File 'lib/multiton/mixin.rb', line 24 def clone raise TypeError, "can't clone instance of multiton `#{self.class.name}`" end |
#dup ⇒ Object
35 36 37 |
# File 'lib/multiton/mixin.rb', line 35 def dup raise TypeError, "can't dup instance of multiton `#{self.class.name}`" end |