Module: StepSequencer::Refinements::SymbolCall

Defined in:
lib/step_sequencer/refinements.rb

Overview

Symbol#call


cryptic but immensely useful. It enables passing arguments with the symbol-to-proc shorthand, e.g.:

[1,2,3].map(&:+.(1)) == [2,3,4]

source: stackoverflow.com/a/23711606/2981429

Instance Method Summary collapse

Instance Method Details

#call(*args, &block) ⇒ Object



80
81
82
# File 'lib/step_sequencer/refinements.rb', line 80

def call(*args, &block)
  ->(caller, *rest) { caller.send(self, *rest, *args, &block) }
end