How about:

```ruby
Crichton.raw_profile_registry.each do |id, profile|
  %w(xml json).each do |ext|
     doc = profile.send("to_#{ext}")
     File.open(File.join(directory, "#{id}.#{ext}"), 'w') { |f| f.write(doc) }
   end      
end
```
Note: I removed the _profile in the name.