lib/ect.rb in ect-1.0.0 vs lib/ect.rb in ect-1.1.0
- old
+ new
@@ -1,9 +1,9 @@
module Ect
- VERSION = '1.0.0'
+ VERSION = '1.1.0'
end
class Object
@@ -21,8 +21,13 @@
alias bisect partition
def dissect
inject([]) { |a, elt| (a[yield(elt)] ||= []) << elt; a }
+ end
+
+ def elect
+
+ find { |elt| r = yield(elt); break r if r }
end
end