Use default value if item not found in array

272 viewsrubyselectruby select

So I’ve got my code trying to select an object from an array of objects, and if the object isn’t found, I want to create my defaults.

lead_time ={|d| unless d.day_of_week == day }

however, from what I can tell, this is not returning me the devault LeadTimeProfile.

is there a way of doing this? Or have I got it right?