Type inference With type restrictions Without type restrictions 1. Assigning a literal value 2. Assigning the result of invoking the class method new 3. Assigning a variable th...
Coding Style Naming Acronyms Libs Directory and File Names Indentation Coding Style This style is used in the standard library. You can use it in your own project to make i...
Classes Classes Avoid the usage of class (@@ ) variables due to their “nasty” behavior in inheritance. [link ] class Parent @ @class_var = 'parent' ...
Blocks and Procs Overloads Yield arguments Short one-parameter syntax yield value Type restrictions break next with … yield Unpacking block parameters Performance Bloc...
Enable Sessions Usage Sharing session values between applications Enable Sessions Sessions are available in Hanami applications, but not enabled by default. If we want to tur...
Inheritance super Covariance and Contravariance Inheritance Every class except Object , the hierarchy root, inherits from another class (its superclass). If you don’t specify...
Methods and instance variables Getters and setters Redefining methods, and previous_def Catch-all initialization Methods and instance variables We can simplify our constructo...
Methods and instance variables Getters and setters Redefining methods, and previous_def Catch-all initialization Methods and instance variables We can simplify our constructo...
Methods and instance variables Getters and setters Redefining methods, and previous_def Catch-all initialization Methods and instance variables We can simplify our construct...
Methods and instance variables Getters and setters Redefining methods, and previous_def Catch-all initialization Methods and instance variables We can simplify our constructo...