Skip to content
academia.sh

Unit 01 of 02

Language Basics

A design that puts readability first turning even operators into methods, primitive values being objects too, naming rules and scope sigils, conditions and loops that produce values, methods with implicit return, and symbols and strings being two separate representations.

Published Updated

Lessons

  1. 01 The Design Philosophy of Ruby In Ruby, 5 + 3, x = 5, the map of an array, and 5.between?(1, 10) are written the same way, yet the code that produces each result lives in four different places. This lesson measures those four responders with twelve observations and shows that a design that puts readability first turns even operators into methods. 14 min read
  2. 02 An Intuition for the Object Model Numbers, nil, and true are objects too; in 5 + 3 the receiver is 5 and the responder is Integer; classes are objects themselves, and another class answers the messages sent to them. 15 min read
  3. 03 Variables and Constants In Ruby, assignment is syntax rather than a message; local variables, instance variables, global variables, and constants are told apart by the sigil on the name; the limits measured with defined?. 3 min read
  4. 04 Control Flow The case expression sends the === message to each when branch, while if and while are syntax that sends no message; statement modifiers and the value of if; the responder of case is the class of the branch object. 13 min read
  5. 05 Methods Receiverless calls live in the Kernel module; method definitions with default values, variadic arguments, and keyword arguments; implicit return; a top-level def is written into Object and stays private. 14 min read
  6. 06 Symbols and Strings A string turning into a symbol and the identity difference between the two representations; string literals frozen by a magic comment, and the comment taking effect per file; the magic comment not changing the responder. 5 min read

Start typing to search.

↑↓ ↵ Esc navigate · open · close