How about the following for better understandability:

```ruby
  def self.register(resource_descriptor)
        hash_descriptor = case resource_descriptor
        when String
          raise ArgumentError, "Filename #{resource_descriptor} is not valid." unless File.exists?(resource_descriptor)
          YAML.load_file(resource_descriptor)
        when Hash
          resource_descriptor
        else
          raise ArgumentError, "Document #{resource_descriptor} must be a String or a Hash."
        end

        # Collect the hash fragments for dereferencing keyed by the ID (which is a link to a descriptor element)
        collect_descriptor_ids(hash_descriptor)

        add_resource_descriptor_to_dereferencing_queue(hash_descriptor)
        add_resource_descriptor_to_registry(hash_descriptor, raw_registry)
      end

  def self.enqueue_hash_descriptor_for_dereferencing(hash_descriptor)
        (@dereference_queue ||= []) << hash_descriptor
  end
```