Sha256: 95a20f1a7d60ad752852c6ebd38a38f560bc5e1087891ddbdfa6597e30bbdfe7
Contents?: true
Size: 587 Bytes
Versions: 30
Compression:
Stored size: 587 Bytes
Contents
require 'backports/1.8.7/enumerable/one' if Enumerable.instance_method(:one?).arity == 0 require 'backports/tools/alias_method_chain' require 'backports/tools/arguments' module Enumerable def one_with_pattern?(pattern = Backports::Undefined, &block) return one_without_pattern?(&block) if Backports::Undefined == pattern found_one = false each_entry do |o| if pattern === o return false if found_one found_one = true end end found_one end Backports.alias_method_chain(self, :one?, :pattern) end end
Version data entries
30 entries across 30 versions & 3 rubygems