Skip to content

Add #merge! support to AttachmentsList #1296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

caioertai
Copy link

Not sure if this is a generally desired feature, but it seems natural to me that this should be possible since it shares Hash behaviors:

attachments = {
  'test.pdf' => read_raw_fixture('attachments', 'test.pdf'),
  'test.gif' => read_raw_fixture('attachments', 'test.gif'),
  'test.jpg' => read_raw_fixture('attachments', 'test.jpg')
}
mail.attachments.merge!(attachments)

The fact that there's a #merge! without an otherwise expected #merge irks me a bit. But it seems a simple improvement to the class.

Thoughts?

@jeremy jeremy added this to the 2.8.0 milestone Dec 11, 2018
Copy link
Collaborator

@jeremy jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition. Could you fix the test to not expect specific sort ordering and squash your commits? Thanks!

expect(mail.attachments[1].filename).to eq 'test.gif'
expect(mail.attachments[2].filename).to eq 'test.jpg'
expect(mail.attachments[3].filename).to eq 'test.zip'
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hashes are unordered on older Ruby 1.8 so this is breaking CI.

@caioertai
Copy link
Author

caioertai commented Dec 12, 2018

Fixed it. And sorry for not testing on Ruby 1.8.7. Openssl acts up with Ubuntu 18.04. Ran it through a container this time.

@caioertai caioertai changed the title Add #merge support to AttachmentsList Add #merge! support to AttachmentsList Oct 21, 2021
@caioertai
Copy link
Author

It's been a while since I've looked at this. Is there anything I can do here, @jeremy? Thank you.

@caioertai caioertai requested a review from jeremy January 25, 2023 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants