Advertisement
tyler569

fixed ruby

Jan 25th, 2020
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.21 KB | None | 0 0
  1. irb(main):001:0> class Array
  2. irb(main):002:1> def filter(&block)
  3. irb(main):003:2> self.select(&block)
  4. irb(main):004:2> end
  5. irb(main):005:1> end
  6. => :filter
  7. irb(main):006:0> [1, 2, 3].filter(&:even?)
  8. => [2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement