class Magick::RVG::Content

Content is simply an Array with a deep_copy method. When unit-testing, it also has a deep_equal method. @private

Public Instance Methods

deep_copy(h = {}) click to toggle source
# File lib/rvg/container.rb, line 11
def deep_copy(h = {})
  me = __id__
  copy = h[me]
  unless copy
    copy = self.class.new
    each do |c|
      copy << if c.nil?
                nil
              elsif c.respond_to?(:deep_copy)
                c.deep_copy(h)
              elsif c.respond_to?(:dup)
                begin
                  c.dup
                rescue StandardError
                  c
                end
              else
                c
              end
    end
    copy.freeze if frozen?
    h[me] = copy
  end
  copy
end