Sha256: 586b45e572ea497d99358989aaf4e3c82263c900310fdd0ec310715c08751c42

Contents?: true

Size: 145 Bytes

Versions: 169

Compression:

Stored size: 145 Bytes

Contents

module Tins
  module CountBy
    def count_by(&b)
      b ||= lambda { |x| true }
      inject(0) { |s, e| s += 1 if b[e]; s }
    end
  end
end

Version data entries

169 entries across 151 versions & 9 rubygems

Version Path
tins-1.33.0 lib/tins/count_by.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/lib/tins/count_by.rb
tins-1.32.1 lib/tins/count_by.rb
tins-1.32.0 lib/tins/count_by.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/lib/tins/count_by.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/lib/tins/count_by.rb
tins-1.31.1 lib/tins/count_by.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/tins-1.31.0/lib/tins/count_by.rb
tins-1.31.0 lib/tins/count_by.rb
tins-1.30.0 lib/tins/count_by.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/lib/tins/count_by.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/lib/tins/count_by.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/lib/tins/count_by.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/lib/tins/count_by.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/count_by.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/lib/tins/count_by.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/lib/tins/count_by.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/lib/tins/count_by.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/lib/tins/count_by.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/lib/tins/count_by.rb