module RubyXL::RelationshipSupport

def attach_relationship(rid, rf)

def attach_relationship(rid, rf)
  relationships = self.class.class_variable_get(:@@ooxml_relationships)
  klass = rf.class
  if relationships.has_key?(klass) then
    accessor = relationships[klass]
    case accessor
    when NilClass then
      # Relationship is known, but we don't have a special accessor for it, store as generic
      store_relationship(rf)
    when false then
      # Do nothing, the code will perform attaching on its own
    else
      container = self.send(accessor)
      if container.is_a?(Array) then container << rf
      else self.send("#{accessor}=", rf)
      end
    end
  else store_relationship(rf, :unknown)
  end
end