The instance variable holds data specific to each object of the class.
I initialized the instance variable in the constructor for better organization.
If it starts with , it is an instance variable.
The module also has an initialize method which just creates a @scope instance variable and sets it to be an empty hash.
Il module ha anche un metodo initialize che crea semplicemente una variabile di istanza @scope e la imposta per essere un hash vuoto.
You can modify the instance variable using setter methods if necessary.
You can access the instance variable directly from any method within the class.
Puoi accedere direttamente alla variabile d'istanza da qualsiasi metodo all'interno della classe.
Understanding how to declare an instance variable is crucial for object-oriented programming.
Capire come dichiarare una variabile d'istanza è fondamentale per la programmazione orientata agli oggetti.
When creating an object, the instance variable is automatically assigned a value.
Quando si crea un oggetto, la variabile d'istanza viene automaticamente assegnata a un valore.
An instance variable is different from a local variable in several ways.
Una variabile d'istanza è diversa da una variabile locale in vari modi.
Each instance of the class has its own separate instance variable.
Ogni istanza della classe ha la sua separata variabile d'istanza.
This is an instance variable, and is available to all the methods of the class.
Questa è una variabile d'istanza ed è disponibile a tutti i metodi della classe.
Thus, to access a method or property of a class, we need to use the name of the instance variable or the classname first.
Quindi per accedere ad un metodo o ad un attributo di una classe dobbiamo premettere il nome della variabile di istanza o della classe.
We want the controller to have an index action so we've replaced the self.call method with an index method that makes the same call to ps we had before, but which assigns the output to an instance variable.
Vogliamo che il controller abbia una action index, per cui abbiamo sostituito il metodo self.call con un metodo index che fa le stesse chiamate al ps che avevamo prima, ma che assegna l'output a una variabile di istanza.