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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:47:03+00:00 2026-05-31T23:47:03+00:00

The syntax for mapping: a = [a, b, c, d] #=> [a, b, c,

  • 0

The syntax for mapping:

a = ["a", "b", "c", "d"]      #=> ["a", "b", "c", "d"] 
a.map {|item|"a" == item}     #=> [true, false, false, false] 
a.select {|item|"a" == item}  #=> ["a"]

Question how about if I have:

 irb(main):105:0> details[1]
 => {:sku=>"507772-B21", :desc=>"HP 1TB 3G SATA 7.2K RPM LFF (3 .", :qty=>"", 
 :qty2=>"1", :price=>"5,204.34 P"}

I want to delete every entry which has an empty qty value on this array or select only the ones with some value in it.

I tried:

details.map {|item|"" == item}

Just returns a lot of false and then when I use the same just change map to select I get:

[]
  • 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-31T23:47:05+00:00Added an answer on May 31, 2026 at 11:47 pm

    It looks like details is an array of hashes. So item inside of your block will be the whole hash. Therefore, to check the :qty key, you’d do something like the following:

    details.select{ |item| item[:qty] != "" }
    

    That will give you all items where the :qty key isn’t an empty string.

    official select documentation

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

Sidebar

Related Questions

Naive question about Java syntax. What does <T> T accept(ObjectVisitorEx<T> visitor); mean? What would
I have an existing NHibernate 2.1.2.4000 mapping that uses the mapping syntax: <database-object> <create>
I have the following mapping defined: protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<InsuranceProvider>() .Map(ins
Ruby syntax reference says about case statements: Comparisons are done by operator === infact,
Im get stuck with AutoMapper syntax. How to skip mapping members in the nested
I have an xml mapping file that looks something like this <colourMappings> <model name=modelX>
I am trying to define xml mapping for a Map<String,String> field. The entity class
Hey all. Quick question on Fluent syntax. I had thought I had this down,
I have the Vehicles class and mapping file for it and i want to
I'm having some trouble figuring out the appropriate FluentNHibernate mapping syntax for the following

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.