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 8230987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:19:22+00:00 2026-06-07T17:19:22+00:00

Here is the big hash that I start with (actually its been refined a

  • 0

Here is the big hash that I start with (actually its been refined a step or two but this is what I’m starting with at this point.

angel_hash = {"follower_count"=>1369, "name"=>"AngelList", "markets"=>
[{"display_name"=>"Startups", "name"=>"startups", "id"=>448, "tag_type"=>"MarketTag", 
"angellist_url"=>"http://angel.co/startups-1"}, {"display_name"=>"Venture Capital",
 "name"=>"venture capital", "id"=>856, "tag_type"=>"MarketTag", 
"angellist_url"=>"http://angel.co/venture-capital"}], "video_url"=>"", 
"created_at"=>"2011-03-18T00:24:29Z", "updated_at"=>"2012-07-09T14:12:28Z", 
"product_desc"=>"AngelList is a platform for startups to meet investors and talent. ", 
"blog_url"=>"http://blog.angel.co", 
"thumb_url"=>"https://s3.amazonaws.com/photos.angel.co/startups/i/6702-
766d1ce00c99ce9a5cbc19d0c87a436e-thumb_jpg.jpg", "id"=>6702, 
"company_url"=>"http://angel.co", "locations"=>[{"display_name"=>"San Francisco", 
"name"=>"san francisco", "id"=>1692, "tag_type"=>"LocationTag", 
"angellist_url"=>"http://angel.co/san-francisco"}], "community_profile"=>false, "status"=>
{"message"=>"Done Deal: @volunteerspot raises $1.5M 
http://techcrunch.com/2012/06/27/targeting-power-moms-volunteerspot-secures-1-5m-in-   
series-a-from-ff-venture-capital-and-more/ \316\207 20 intros on AngelList \316\207 Funded 
by @ff-venture-capital", "created_at"=>"2012-06-28T20:37:58Z", "id"=>63110},
"twitter_url"=>"http://twitter.com/angellist", "high_concept"=>"A platform for startups", 
"logo_url"=>"https://s3.amazonaws.com/photos.angel.co/startups/i/6702
-766d1ce00c99ce9a5cbc19d0c87a436e-medium_jpg.jpg", 
"angellist_url"=>"http://angel.co/angellist", "screenshots"=>
  [{"thumb"=>"https://s3.amazonaws.com/screenshots.angel.co/98/6702/009cff275fb96709c915c4d4abc9 
43d6-thumb_jpg.jpg", 

"original"=>"https://s3.amazonaws.com/screenshots.angel.co/98/6702/009cff275fb96709c915c4d4abc
943d6-original.jpg"}], "hidden"=>false}

Out of this hash I parsed out some elements, and am doing just fine until I run into the embedded arrays

module SimpleAngel
  class Company

    attr_accessor :followers, :company_name, :markets_array, :date_joined, :locations_array
    attr_accessor :high_concept, :high_concept_long, :thumbnail_logo, :full_size_logo
    attr_accessor :angel_url, :twitter_url, :company_url, :blog_url

    def initialize(angel_hash)
      @followers = angel_hash['follower_count']
      @company_name = angel_hash['name']
      @markets_array = angel_hash['markets']
      @markets_array.each_with_index do |market, i|
      ###This is where I'm stuck. I want to pull out individual elements 
       # from each array AND dynamically assign unique instance variable names for   
       # each separate market in the markets array. Something like @market1_name, 
       # @market1_id, etc.

    end


    @date_joined = angel_hash['created_at']
    @locations_array = angel_hash['locations']
    @high_concept = angel_hash['high_concept']
    @high_concept_long = angel_hash['product_desc']
    @thumbnail_logo = angel_hash['thumb_url']
    @full_size_logo = angel_hash['logo_url']
    @angel_url = angel_hash['angellist_url']
    @twitter_url = angel_hash['twitter_url']
    @company_url = angel_hash['company_url']
    @blog_url = angel_hash['blog_url']
  end

 end
end
  • 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-06-07T17:19:24+00:00Added an answer on June 7, 2026 at 5:19 pm

    Here’s a direct answer to your question: you can define arbitrary instance variable by calling instance_variable_set.

    @markets_array.each_with_index do |market, i|
      market.each do |k, v|
        instance_variable_set "market#{i}_#{k}", v
    
        # this will define @market0_id = 448  
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a (big) example of the massive problem I am having, when this
I've had a few questions about MEF recently, but here's the big one --
There is a big design flaw here, but I'm having trouble solving it: The
I have been running around here and there on NoSQL big data storage technologies.
What has been happening with the four big P2P distributed hash table (DHT) overlay
I'm nearly finished with this project but I have been beating my head against
My big problem here is that I'm 1 day into learning MacOSX so the
Here's my big trouble. I'm trying to invoke a specific ws with this request:
Here's the big picture. We're running a server in IIS 6 that hosts several
Here is my incomplete StructureMap configuration: PS: Big apologies for asking you to write

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.