From: 7stud -- Date: 2012-09-10T12:25:04+09:00 Subject: Re: Need help with my logic sharmin malik wrote in post #1075245: > 7stud -- wrote in post #1075239: >> given_server = "DK-vk-2.domain.lan" >> server_types = ['vk', 'vh', 'vm'] >> >> start, type, the_rest = given_server.split('-') >> puts type >> >> --output:-- >> vk >> >> other_two = (server_types - [type]).map do |new_type| >> [start, new_type, the_rest].join('-') >> end >> >> p other_two >> >> --output:-- >> ["DK-vh-2.domain.lan", "DK-vm-2.domain.lan"] > > Hi > also could you please explain to me , how it working ?? > > other_two = (server_types - [type]).map do |new_type| > [start, new_type, the_rest].join('-') > end > > how it deleting vk from the list ?? p server_types - [type] --output:-- ["vh", "vm"] -- Posted via http://www.ruby-forum.com/.