What are we talking about? Ruby claims to make things easier for developers, but sometimes that flexibility feels like complexity. For example, Ruby supports 4 different ways to reference (and later execute) a piece of code: - methods - blocks - procs - lambdas
We’re talking about: procs and lambdas what if ... you could treat code as if it were data or an object? that’s what procs and lambdas do for you. they let you wrap code and pass it around in variables and collections. and the two are essentially the same thing except for a little syntax and 2 differences in behavior.
We’re talking about: open source for study Sample Project: GitLab - github.com/gitlabhq/gitlabhq - Self hosted Git management software Fast and easy Git repositories, hosted either on your own or at Gitlab.com. Create projects and repositories, manage access and perform collaborative code reviews. - 200,000 lines of code and 600 classes among 2800 files
summary - Ruby let’s you “name” a piece of code to run later. - methods and blocks can’t be passed around like objects - procs and lambdas can. what else? - embrace the confusion - have faith in your own work - keep exploring, playfully