Print out the indifferences between two arrays?

How can I print out the indifferences between two arrays? where the
valid indifferences come from a list within a .yaml file?

This is what I have but it is not working.

matchenv = YAML::load_file(‘environments.yml’)

match environments from the services field that may contain

environments not listed in the environments.yml file

matchme = matchenv.to_a & odb[server][‘services’].to_a

Richard S. wrote in post #1003587:

How can I print out the indifferences between two arrays? where the
valid indifferences come from a list within a .yaml file?

This is what I have but it is not working.

What do you mean “not working”? Show what you get, and what you want
instead.

matchme = matchenv.to_a & odb[server][‘services’].to_a

p matchenv.to_a
p odb[server][‘services’].to_a
p matchme

Then describe what you want instead for the matchme output.

Richard S. wrote in post #1003587:

How can I print out the indifferences between two arrays?

What does indifference mean?

where the
valid indifferences come from a list within a .yaml file?

Where your arrays come from is irrelevant.

match environments from the services field that may contain

environments not listed in the environments.yml file

My interpretation of that gobbledygook is that you want to find things
in one array (‘the services field’) that ARE NOT contained in another
array (environments.yaml).

services = [1, 2, 3]
environment = [2, 3, 4, 5, 6]

results = services - (services & environment)
p results

–output:–
[1]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs