Module: Tins::CountBy
- Extended by:
- Deprecate
- Defined in:
- lib/tins/count_by.rb
Instance Method Summary collapse
Methods included from Deprecate
Instance Method Details
#count_by(&block) ⇒ Object
6 7 8 9 |
# File 'lib/tins/count_by.rb', line 6 def count_by(&block) block ||= lambda { |x| true } inject(0) { |s, e| s += 1 if block.call(e); s } end |