Disable copying via dup and clone (and copy).
Usage
require 'carat/notcopyable.rb'
Class FixedString < String
include NotCopyable
end
s = FixedString.new("Don't tred on me!")
puts s
s2 = s.dup
produces
Don't tred on me! TypeError, "Object not copyable"
Notes
- I don’t think this will prove very useful, but just in case here it is.
Author(s)
- Paul Brannan <paul at atdesk.com>
- Thomas Sawyer
Methods
Public Instance methods
clone()
[ source ]
Alias for copy
dup()
[ source ]