detect
method RB-PR1007Usages of select.first
, select.last
, find_all.first
, and find_all.last
can be changed to use detect
instead.
ActiveRecord compatibility: ActiveRecord does not implement a detect
method and find
has its own meaning.
[].select { |item| true }.first
[].select { |item| true }.last
[].find_all { |item| true }.first
[].find_all { |item| true }.last
[].detect { |item| true }
[].reverse.detect { |item| true }