Module: Gemmy::Patches::SymbolPatch
- Defined in:
- lib/gemmy/patches/symbol_patch.rb
Overview
Symbol patches
Instance Method Summary collapse
-
#with(*args, &block) ⇒ Object
Patch symbol so the proc shorthand can take extra arguments stackoverflow.com/a/23711606/2981429.
Instance Method Details
#with(*args, &block) ⇒ Object
Patch symbol so the proc shorthand can take extra arguments stackoverflow.com/a/23711606/2981429
Example: [1,2,3].map &:*.with(2)
> [2,4,6]
11 12 13 |
# File 'lib/gemmy/patches/symbol_patch.rb', line 11 def with(*args, &block) ->(caller, *rest) { caller.send(self, *rest, *args, &block) } end |