--
-$Id: ChangeLog 69 2005-09-19 20:17:07Z tilman $
+$Id: ChangeLog 70 2005-09-21 15:56:55Z tilman $
++
+2005-09-21 Tilman Sauerbeck (tilman at code-monkey de)
+ * lib/redact/part.rb: Added Description#inherit
+
2005-09-19 Tilman Sauerbeck (tilman at code-monkey de)
* lib/redact/part.rb: Fixed ImageDescription#set_border, which
used the "right" argument for the "left" border
#--
-# $Id: part.rb 69 2005-09-19 20:17:07Z tilman $
+# $Id: part.rb 70 2005-09-21 15:56:55Z tilman $
#
# Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
#
@color_class = ""
end
+ def inherit(other)
+ unless other.is_a?(Description)
+ raise(ArgumentError, "Cannot inherit from description")
+ end
+
+ prot = ["@name", "@value"]
+
+ (instance_variables - prot).each do |v|
+ n = other.instance_variable_get(v.intern)
+ n = n.dup rescue n
+ instance_variable_set(v.intern, n)
+ end
+ end
+
def visible=(v)
@visible = (v == true)
end