Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 770 Bytes

ruby.md

File metadata and controls

17 lines (14 loc) · 770 Bytes

Ruby

Lambdas and Procs

  • See here: Procs
  • The shorthand for creating Procs is Kernel.lambda BUT WITH SOME SLIGHT DIFFERENCES:
    • lambdas check the number of parameters passed when called (throws ArgumentError)
    • A return from a Proc returns from the enclosing method whereas lambdas return control to the caller
  • In general, prefer lambda { } over Proc.new to avoid surprising behavior.

Framework specific