Guest User

Untitled

a guest
Apr 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. class Foo
  2. def initialize
  3. self.collection = []
  4.  
  5. collection.extend Finder
  6. end
  7. end
  8.  
  9. module Finder
  10. def [](name)
  11. find { |e| e.name == name } || super
  12. end
  13. end
Add Comment
Please, Sign In to add comment