Recently because of learning puppet related knowledge, so learn the knowledge of Ruby, here is a summary of some of the introduction.
The start and end statements of Ruby.
BEGIN { code}end{ code }
Variables in the class:
The local variable "_" begins----the variable defined in the method and can only be used in a method.
The instance variable "@" begins-----The instance changes from object to object, and can span methods or instances.
The class variable "@@" begins------can be used across objects, belongs to a class, is a property of a class
Global variable "$" starts------cross-class use
Create an object using new
Object = class. New
When you create a new method with parameters, you must first define a initialize method:
The member function starts with a lowercase letter----, preceded by a def ending with end
Ruby Learning Note One