Ruby has a lot of advantages for beginners. Rails is also good for small teams, and solo developing.
self
is a special object that represents different objects at different times.
pp
is a method we use to call the main object "pretty print"
syntactic sugar makes things easier to print
object.method
- the primary method to write examples. what we will be using most often
object.method(parameter)
- make up an expression which is the return value.
self.pp
is more useful when debugging or when you want to inspect data in a more human reading format. Shows the structure and nesting which makes it easier to understand complex nested objects.
gsub
- globally substitute, will replace all occurrences of one substring w another substring. Often used to remove illegal characters from usernames before saving.
Skill leves as a programmer is essential and about the number of error messages that you have encountered in the past and now recognize.
use #comments
liberally.
=
- variable assignment operator, evaluates right side first. Most ruby methods don't modify the object they are called upon. Rather they just return a modified copy.
Variables can only contain lowercase letters, numbers, and underscores, no spaces and cant begin with a number. They should be descriptive no matter the length.
Top comments (0)