Module: Tins::UniqBy
- Extended by:
- Deprecate
- Defined in:
- lib/tins/uniq_by.rb
Instance Method Summary collapse
Methods included from Deprecate
Instance Method Details
#uniq_by(&block) ⇒ Object
6 7 8 9 |
# File 'lib/tins/uniq_by.rb', line 6 def uniq_by(&block) block ||= lambda { |x| x } inject({}) { |h, e| h[ block.call(e) ] ||= e; h }.values end |