Saturday, December 12, 2015

Notes for 5 Hidden Gems of the Ruby Standard Library Presentation

Set
- It doesn't keep order
- It doesn't support duplicates
- It's very fast at finding elements


BLACKLISTED_IPS = %w(42.100.119.12 61.103.82.121)

def black_listed?(ip)
  BLACKLISTED_IPS.include?(ip)
end

vs

require 'set'

same code as before