Skip to content
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

NameError: undefined local variable or method `elements' for nil:NilClass #554

Open
rwz opened this issue Jun 4, 2013 · 2 comments
Open

Comments

@rwz
Copy link

rwz commented Jun 4, 2013

ruby 1.9.3p392 (2013-02-22 revision 39386)

>> ::Mail::Address.new('').display_name
=> nil

ruby 1.9.2p320 (2012-04-20 revision 35421)

>> ::Mail::Address.new('').display_name
NameError: undefined local variable or method `elements' for nil:NilClass
  from /rubygems-path-goes-here/gems/mail-2.5.4/lib/mail/parsers/rfc2822.rb:2864:in `comments'
  from /rubygems-path-goes-here/gems/mail-2.5.4/lib/mail/elements/address.rb:222:in `get_comments'
  from /rubygems-path-goes-here/gems/mail-2.5.4/lib/mail/elements/address.rb:129:in `comments'
  from /rubygems-path-goes-here/gems/mail-2.5.4/lib/mail/elements/address.rb:232:in `get_display_name'
  from /rubygems-path-goes-here/gems/mail-2.5.4/lib/mail/elements/address.rb:88:in `display_name'
  from (irb):1
@srawlins
Copy link
Contributor

srawlins commented Jul 1, 2013

For Mail 2.5.4, I see the following:

$ rbenv shell 2.0.0-p247
$ ruby -r mail -e "puts (::Mail::Address.new('').display_name).inspect"
nil
$ rbenv shell 2.1.0-dev
$ ruby -v
ruby 2.1.0dev (2013-06-15) [x86_64-linux]
$ ruby -r mail -e "puts (::Mail::Address.new('').display_name).inspect"
nil

Looks like the problem is just Ruby 1.9.2?

@jeremy
Copy link
Collaborator

jeremy commented May 17, 2017

@rwz on the off chance you still have Ruby 1.9.2, what does this report for you?

>> RUBY_DESCRIPTION
=> "ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]"
>> Mail::AddressListsParser.new.parse('').elements
=> [SyntaxNode offset=0, "", SyntaxNode offset=0, ""]
>> RUBY_DESCRIPTION
=> "ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-darwin16.3.0]"
>> Mail::AddressListsParser.new.parse('').elements
=> [SyntaxNode offset=0, "", SyntaxNode offset=0, ""]
>> RUBY_DESCRIPTION
=> "ruby 1.8.8dev (2014-01-28 trunk 56877) [i386-darwin16.3.0]"
>> Mail::AddressListsParser.new.parse('').elements
=> [SyntaxNode offset=0, "", SyntaxNode offset=0, ""]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants