Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6109267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:23:08+00:00 2026-05-23T14:23:08+00:00

I am still very new to Ruby and was wondering how I would access

  • 0

I am still very new to Ruby and was wondering how I would access a data element stored in a “double less than” structure:

@email << {:envelope => envelope, :body => body}

If I do

<% @results.email.each do |result| %>

  <%= result %>

<% end %>

I get

bodyTEST TEST envelope#<struct Net::IMAP::Envelope date="Tue, 28 Jun 2011 09:20:35 -0700", subject="TEST TEST", from=[#<struct Net::IMAP::Address name="Some Name", route=nil, mailbox="someinbox", host="somehost.com">], sender=[#<struct Net::IMAP::Address name="Somename", route=nil, mailbox="somebox", host="somedomaincom">], reply_to=[#<struct Net::IMAP::Address name="SomePerson", route=nil, mailbox="somemailbox", host="somehost.com">], to=[#<struct Net::IMAP::Address name=nil, route=nil, mailbox="thisinbox", host="somehost.com">], cc=nil, bcc=nil, in_reply_to=nil, message_id="<C4427977-8A42-46E4-ADB4-1AE88ED9CCDE@mehost.com>">

How do access each element, like body, envelope, sender (within envelope)? result.body doesn’t work, nor does result[body].

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:23:09+00:00Added an answer on May 23, 2026 at 2:23 pm

    You should use result[:body] and not result[body]. body is a variable, whereas :body is a symbol (similar to a string).

    Notice that you have stored values in the hash with symbols. {:envelope => envelope; :body => body} is storing the content of the variable envelope (the one on the right) as the value against the key :envelope (and the same for body and :body).

    Note: This is a nice write up on how Symbols differ from Strings – http://www.robertsosinski.com/2009/01/11/the-difference-between-ruby-symbols-and-strings/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am still very new to Ruby (reading through the Pickaxe and spending most
Sorry for the newbie question but still very new to Ruby and Mongo. Not
This should be a very basic question, I'm still new to ruby so i'd
I'm still very new to Objective C, and I was wondering something regarding viewDidDisappear.
I still very new using Subversion. Is it possible to have a working copy
I am still very new to the MVC framework, but I managed to create
I'm VERY new to WPF, and still trying to wrap my head around binding
Still very new to Rails. How do I call my method in calltwitter.rb file
I'm still very new to codeigniter. The issue i'm having is that the file
I am still very new to routing with asp.net mvc, so perhaps this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.