Sha256: 90672558596fe289d0b0fd8e9a56ce47d66a4850abc6e18a1ddcd3a1b095d61c
Contents?: true
Size: 457 Bytes
Versions: 5
Compression:
Stored size: 457 Bytes
Contents
require 'tins/string_version' module Tins module CountBy if Tins::StringVersion.compare(RUBY_VERSION, :<=, "1.8") def count_by(&block) block ||= lambda { |x| true } inject(0) { |s, e| s += 1 if block.call(e); s } end else require 'tins/deprecate' extend Tins::Deprecate deprecate method: def count_by(&block) count(&block) end, new_method: :count end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
tins-1.37.0 | lib/tins/count_by.rb |
tins-1.36.1 | lib/tins/count_by.rb |
tins-1.36.0 | lib/tins/count_by.rb |
tins-1.35.0 | lib/tins/count_by.rb |
tins-1.34.0 | lib/tins/count_by.rb |