Guest User

Untitled

a guest
Jan 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. class A
  2. def self.[]
  3. # some_argument
  4. end
  5. end
  6.  
  7. class A
  8. def self.[](arg)
  9. puts arg
  10. end
  11. end
  12.  
  13. A[1]
  14. # => 1
  15.  
  16. class A
  17. def self.[](*args)
  18. puts args
  19. end
  20. end
  21.  
  22. > A[1,2,3]
  23. 1
  24. 2
  25. 3
Add Comment
Please, Sign In to add comment