Module NotCopyable
In: lib/facet/notcopyable.rb

Description

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

clone   copy   deep_copy   dup  

Constants

VERSION = '1.0.0'

Public Instance methods

if object/copy has been required?

deep_copy()

Alias for copy

[Validate]