mikel / mikel/tmail

Tiny bug (fix) in entity_tmail.rb's from_tmail(tmail)

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
74
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Seems there are instance variables in this method where there shouldn't be. Replace each so the method looks like this and you won't get any whiny nil errors about nil.header calls:

```
def from_tmail(tmail)
raise ArgumentError, "Expecting a TMail::Mail object." unless tmail.is_a?(TMail::Mail)
@headers ||= Hash.new {|h,k| tmail.header[k].to_s }
if multipart?
@content = tmail.parts.collect { |tpart| Entity.new.from_tmail(tpart) }
else
set_content tmail.body # TMail has already decoded it, but we need it still encoded
end
end
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect entity_tmail.rb's from_tmail(tmail) method and compare its instance-variable usage with the implementation shown in the issue. Run the existing test suite if available. Done means the method no longer produces nil.header errors and matches the requested variable scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.