aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
new file mode 100644
index 0000000000..497ca52c2d
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -0,0 +1,9 @@
+module Enumerable
+ def first_match
+ match = nil
+ each do |items|
+ break if match = yield(items)
+ end
+ match
+ end
+end \ No newline at end of file