moduleEnumerabledefmdetect
each {|o| v =yield(o);return v if v }returnnilendend
describe "mdetect"do
it "should return the value returned from the block"do
['cat food','dog food','bird food'].mdetect {|s| s.match(/dog/)}.should be_an_instance_of(MatchData)end
it "should return nil if nothing is found"do
[1,2,3].mdetect {false}.should be_nil
endend