hash = {
“price”: “419.5”,
“pricelevelname”: “STOCKING DEALER”
}
Expected Result
{
“price_STOCKING DEALER”: “419.5”,
“pricelevelname”: “STOCKING DEALER”,
}
how to achieve this
hash = {
“price”: “419.5”,
“pricelevelname”: “STOCKING DEALER”
}
Expected Result
{
“price_STOCKING DEALER”: “419.5”,
“pricelevelname”: “STOCKING DEALER”,
}
how to achieve this
Not really sure what you are trying to achieve here.
Could you elaborate on what you are doing in your posted example?
You have to iterate through the pairs, remove the original key/value pair and add the new one.
Or construct a new hash based on your findings and assign it to the old hash-variable.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs