目前我正在做以下事情,想知道是否有办法合并它?
merged = list_with_objects_that_have_url_and_name_attributes
merged = merged.uniq{|ex| ex.url }
merged = merged.uniq{|ex| ex.name }
我想要类似的东西:
merged.uniq{|ex| ex.name || ex.url}
目前我正在做以下事情,想知道是否有办法合并它?
merged = list_with_objects_that_have_url_and_name_attributes
merged = merged.uniq{|ex| ex.url }
merged = merged.uniq{|ex| ex.name }
我想要类似的东西:
merged.uniq{|ex| ex.name || ex.url}