Class: Symbol
Overview
Symbol monkey patch to allow map(&:method) to take arguments. Allows: [2,3].map(&:+.with(10)) # => [12,13] See: stackoverflow.com/questions/23695653/can-you-supply-arguments-to-the-mapmethod-syntax-in-ruby for more information,
Instance Method Summary collapse
Instance Method Details
#with(*args, &block) ⇒ Object
5 6 7 |
# File 'lib/libis/tools/extend/symbol.rb', line 5 def with(*args, &block) ->(caller, *rest) { caller.public_send(self, *rest, *args, &block) } end |