You can use a little cheating and achieve something similar:
class Symbol def [](*args) proc{|obj| obj.send(self, *args) } end end [123.456, 234.567].map(&:round[2]) #=> [123.46, 234.57]
I am very discouraged by the use in production code, because gems, etc. can rely on Symbol#[] . This is just a fun game to play with :-)
source share