Sha256: de4885a9eee7b245ff48133ed435fe88c297282aa7ba7713c112c619837a4e74

Contents?: true

Size: 146 Bytes

Versions: 17

Compression:

Stored size: 146 Bytes

Contents

module Spruz
  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

17 entries across 17 versions & 1 rubygems

Version Path
spruz-0.2.13 lib/spruz/count_by.rb
spruz-0.2.12 lib/spruz/count_by.rb
spruz-0.2.11 lib/spruz/count_by.rb
spruz-0.2.10 lib/spruz/count_by.rb
spruz-0.2.9 lib/spruz/count_by.rb
spruz-0.2.8 lib/spruz/count_by.rb
spruz-0.2.7 lib/spruz/count_by.rb
spruz-0.2.6 lib/spruz/count_by.rb
spruz-0.2.5 lib/spruz/count_by.rb
spruz-0.2.2 lib/spruz/count_by.rb
spruz-0.2.1 lib/spruz/count_by.rb
spruz-0.2.0 lib/spruz/count_by.rb
spruz-0.1.5 lib/spruz/count_by.rb
spruz-0.1.3 lib/spruz/count_by.rb
spruz-0.1.2 lib/spruz/count_by.rb
spruz-0.1.1 lib/spruz/count_by.rb
spruz-0.1.0 lib/spruz/count_by.rb