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

  • Home
  • SEARCH
  • 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 7176913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:36:16+00:00 2026-05-28T16:36:16+00:00

[[{Postponed=>10}], [{Low=>3}], [{Medium=>4}], [{High=>5}]] is the array how can I get the value corresponding

  • 0
[[{"Postponed"=>10}], [{"Low"=>3}], [{"Medium"=>4}], [{"High"=>5}]]

is the array

how can I get the value corresponding to particular value.

say High returns 5 in this.
or how to convert this array of hashes to an array so that searching becomes easy.

I tried:

find_all { |v| v['name'] == "Low" } 

but it says:

cant convert String to Integer  

please provide some guidance

  • 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-28T16:36:17+00:00Added an answer on May 28, 2026 at 4:36 pm

    If you have some code like:

    array = [[{"Postponed"=>10}], [{"Low"=>3}], [{"Medium"=>4}], [{"High"=>5}]]
    

    Then turn it into an ruby hash:

    hash = array.inject({}) {|h, e| h.merge(e.first) }
    # => {"Postponed"=>10, "Low"=>3, "Medium"=>4, "High"=>5}
    

    So you can find ‘Low’ value easily :

    hash['Low']
    # => 3
    

    EDIT: The answer of Mark Thomas is pretty great, and shorter than the inject since it does the same thing. He wrote it before I answered. Nice 😉

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

Sidebar

Related Questions

I've seen this done in a lot of sites recently, but can't seem to
I'm having a couple of branches, corresponding with abandoned or later postponed development, some
The file I'm loading into the modal dialog can vary in height. When the
I have a JMS client that can ssh to remote systems upon receiving a
When running an svn up I regularly encounter this prompt: Conflict discovered in 'lib/somelibrary.so'.
I have some elements positioned via CSS this way: #myItem{ position: absolute; left: 50%;
Trying to get zeroclipboard positioned properly, and things aren't working quite as expected, even
I have several absolute positioned elements. Is it possible to get all elements with
This is my XAML: <ListView ItemsSource={Binding Items}> <ListView.View> <GridView> <GridViewColumn Header=Property1 DisplayMemberBinding={Binding Property1} />
I'm a beginner and have just about managed to put together this website with

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.