Ruby Programming Language

  1. Methods, Blocks, Procs, and Lambdas
    1. Defining and Calling Methods
      1. Method Syntax
        1. def Keyword
          1. Method Names
            1. End Keyword
            2. Method Naming Conventions
              1. Snake Case
                1. Predicate Methods
                  1. Bang Methods
                  2. Parameters and Arguments
                    1. Required Parameters
                      1. Optional Parameters
                        1. Default Arguments
                          1. Variable-Length Arguments (*args)
                            1. Keyword Arguments
                              1. Double Splat (**kwargs)
                                1. Block Parameters (&block)
                                2. Return Values
                                  1. Implicit Return
                                    1. Explicit Return
                                      1. Multiple Return Values
                                        1. nil Returns
                                      2. Method Scope
                                        1. Local Scope
                                          1. Method-Level Variables
                                            1. Parameter Scope
                                            2. Instance Scope
                                              1. Instance Variable Access
                                                1. Method Visibility
                                                2. Class Scope
                                                  1. Class Method Context
                                                    1. Class Variable Access
                                                    2. Global Scope
                                                      1. Global Variable Access
                                                        1. Top-Level Methods
                                                      2. Blocks
                                                        1. Understanding Blocks
                                                          1. Block Syntax (do...end, { })
                                                            1. Block Parameters
                                                              1. Block Variables
                                                              2. Passing a Block to a Method
                                                                1. Implicit Block Passing
                                                                  1. Block Argument Syntax
                                                                  2. The yield Keyword
                                                                    1. Yielding to Blocks
                                                                      1. Conditional Yielding
                                                                        1. block_given? Method
                                                                        2. Block Variables and Scope
                                                                          1. Block Local Variables
                                                                            1. Variable Shadowing
                                                                              1. Closure Behavior
                                                                            2. Procs
                                                                              1. Creating Proc Objects
                                                                                1. Proc.new
                                                                                  1. proc Method
                                                                                    1. Block to Proc Conversion
                                                                                    2. Calling Procs
                                                                                      1. call Method
                                                                                        1. [] Syntax
                                                                                          1. === Syntax
                                                                                          2. Passing Procs as Arguments
                                                                                            1. Explicit Proc Parameters
                                                                                              1. to_proc Method
                                                                                              2. Storing Procs in Variables
                                                                                                1. Proc Assignment
                                                                                                  1. Proc Collections
                                                                                                2. Lambdas
                                                                                                  1. Creating Lambdas
                                                                                                    1. lambda Method
                                                                                                      1. -> Syntax (Stabby Lambda)
                                                                                                      2. Lambda Syntax
                                                                                                        1. Parameter Syntax
                                                                                                          1. Body Syntax
                                                                                                          2. Differences between Procs and Lambdas
                                                                                                            1. Argument Handling
                                                                                                              1. Strict vs Lenient
                                                                                                                1. Arity Checking
                                                                                                                2. Return Behavior
                                                                                                                  1. Method vs Block Context
                                                                                                                    1. Control Flow Differences
                                                                                                                3. Closures
                                                                                                                  1. Understanding Lexical Scope
                                                                                                                    1. Variable Capture
                                                                                                                      1. Scope Chain
                                                                                                                      2. Capturing Variables in Closures
                                                                                                                        1. Local Variable Binding
                                                                                                                          1. Modification of Captured Variables
                                                                                                                          2. Closure Applications
                                                                                                                            1. Callback Functions
                                                                                                                              1. Event Handlers
                                                                                                                                1. Functional Programming Patterns