This is a personal memo.
In JS, there are declarations such as let
and const
when defining variables, but in ruby there are no declarations in particular, so I tried to find out how to distinguish them, so I summarized them.
Target | Naming convention | Illustration |
---|---|---|
variable | Lowercase. Connect with Ansco | product_name |
constant | All uppercase. Connect with Ansco | PLODUCT_PRICE_LIST |
class | Only the beginning is capitalized. Camel | ProductCategory |
Method | Lowercase. Connect with Ansco | show_price_list |
The constants are all uppercase, so they are easy to distinguish. Don't use hyphens.
Recommended Posts