What's a good way to find whether a hash is a subset of another hash (deep)?

D

dblock

Anyone has a good way to implement is_subset_of for a hash? It needs
to work for deep hashes obviously.

I basically have json data returned in two formats: short and full. I
want to make sure that the short format is an exact subset of the full
format. When they aren't an exact subset I want the fields that exist
in the first hash and don't exist in the second.

Thanks,
-dB.
 
R

Robert Klemme

Anyone has a good way to implement is_subset_of for a hash? It needs
to work for deep hashes obviously.

Why is that obvious? At least for me it isn't.
I basically have json data returned in two formats: short and full. I
want to make sure that the short format is an exact subset of the full
format. When they aren't an exact subset I want the fields that exist
in the first hash and don't exist in the second.

What does "short" and "full" exactly mean?

Kind regards

robert
 
S

Simon Krahnke

* Robert Klemme said:
Why is that obvious? At least for me it isn't.

Maybe that will become clear, once we learn what a deep hash is. Is that
one that Hashes as values? Or, beware, Hashes as keys? Or, something
completely different?
What does "short" and "full" exactly mean?

It means that the short format is an exact subset of the full format.

What is an exact subset? In what way in a Hash a set?

mfg, simon .... l
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top