Skip to content

Commit 8ea6242

Browse files
authored
Merge branch 'master' into Ruby
2 parents 2e14389 + 860f641 commit 8ea6242

File tree

8 files changed

+14
-122
lines changed

8 files changed

+14
-122
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ We accept recommendations from all enthusiastic who care about the quality. The
1313
* [Java](/java/)
1414
* [PHP](/php/)
1515
* [Python](/python/)
16+
* [Ruby](/ruby/)
1617
* [VueJS](/vuejs/)
1718

1819
## Contributions

SUMMARY.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,10 @@
4949
* [Package Naming](python/file-naming.md)
5050
* [Exception( Error ) Naming](python/exception-naming.md)
5151
* [Underscore](python/underscore.md)
52-
52+
* [Ruby](ruby/README.md)
53+
* [Class Naming](ruby/class-naming.md)
54+
* [Constant Naming](ruby/constant-naming.md)
55+
* [Module Naming](ruby/file-naming.md)
56+
* [Method Naming](ruby/method-naming.md)
57+
* [Package Naming](ruby/module-naming.md)
58+
* [Variable Naming](ruby/variable-naming.md)

ruby/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
List of covered sections:
44

5-
* [Class Naming](../Ruby/class-naming.md)
6-
* [Constant Naming](../Ruby/constant-naming.md)
7-
* [Module Naming](../Ruby/file-naming.md)
8-
* [Method Naming](../Ruby/method-naming.md)
9-
* [Package Naming](../Ruby/module-naming.md)
10-
* [Variable Naming](../Ruby/variable-naming.md)
5+
* [Class Naming](../ruby/class-naming.md)
6+
* [Constant Naming](../ruby/constant-naming.md)
7+
* [Module Naming](../ruby/file-naming.md)
8+
* [Method Naming](../ruby/method-naming.md)
9+
* [Package Naming](../ruby/module-naming.md)
10+
* [Variable Naming](../ruby/variable-naming.md)
1111

1212
#### TL;DR
1313

ruby/class-naming.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,12 @@
1-
<<<<<<< Updated upstream
2-
# Python Naming Convention > Class Naming
3-
=======
41
# Ruby Naming Convention > Class Naming
5-
>>>>>>> Stashed changes
62

73
## PascalCase
84

95
* Begin with an uppercase letter
106
* Preferably a noun e.g. Car, Bird, MountainBike
117
* Avoid acronyms and abbreviations
128

13-
<<<<<<< Updated upstream
14-
```python
15-
class Car:
16-
...
17-
```
18-
19-
## Private Class
20-
21-
Python does not support privacy directly. This naming convention is used as a weak internal use indicator.
22-
23-
* Should follow the above naming conventions
24-
* Should use a leading underscore (_) to distinguish between "public" and "private" classes
25-
* For more read the [official python documentation](https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references).
26-
27-
```
28-
class _Car: # private class
29-
```
30-
31-
32-
33-
=======
349
```ruby
3510
class Car
3611
...
3712
```
38-
>>>>>>> Stashed changes

ruby/constant-naming.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1-
<<<<<<< Updated upstream
2-
# Python Naming Convention > Constant Naming
3-
=======
41
# Ruby Naming Convention > Constant Naming
5-
>>>>>>> Stashed changes
62

73
## SCREAMING_SNAKE_CASE
84

95
* Should be all uppercase letters e.g. AGE, HEIGHT
106
* If the name contains multiple words, it should be separated by underscores (_) such as DAYS_IN_MONTH
117
* May contain digits but not as the first letter
128

13-
<<<<<<< Updated upstream
14-
```python
15-
class Product:
16-
MAX_TEMPERATURE = 36;
17-
```
18-
19-
20-
21-
=======
229
```ruby
2310
class Product
2411
MAX_TEMPERATURE = 36;
2512
```
26-
>>>>>>> Stashed changes

ruby/file-naming.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
1-
<<<<<<< Updated upstream
2-
# Python module Convention > Package Naming
3-
=======
41
# Ruby module Convention > File Naming
5-
>>>>>>> Stashed changes
62

73
## snake_case
84

95
* Should be in lowercase.
106
* If the name contains multiple words, an underscore (_) should separate it.E.g. expression_engine
117
* The name should resonate with the class or methods inside the module
128

13-
<<<<<<< Updated upstream
14-
```python
15-
from math import factorial
16-
class Car:
17-
...
18-
```
19-
20-
21-
22-
=======
239
```ruby
2410
require './application_record'
2511
class Car
2612
...
2713
```
28-
>>>>>>> Stashed changes

ruby/method-naming.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
<<<<<<< Updated upstream
2-
# Python Naming Convention > Method Naming
3-
=======
41
# Ruby Naming Convention > Method Naming
5-
>>>>>>> Stashed changes
62

73
## snake_case
84

95
* Should be all in lowercase
106
* Preferably a verb e.g. get_car(), purchase(), book()
117
* If the name contains multiple words, it should be separated by underscores \(\_\) e.g. get\_json\(\)
12-
<<<<<<< Updated upstream
13-
14-
```python
15-
class Person:
16-
def get_height(self):
17-
return self.height
18-
```
19-
20-
## Private Method
21-
22-
Python does not support privacy directly. This naming convention is used as a weak internal use indicator.
23-
24-
* Should follow the above naming conventions
25-
* Should use a leading underscore (_) to distinguish between "public" and "private" functions in a module
26-
* For more read the [official python documentation](https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references).
27-
28-
```
29-
class Person:
30-
def _foot_to_centimeter(self): # private method
31-
return self.height * 30.48
32-
```
33-
34-
35-
36-
=======
378
* Clear and descriptive method names without abbreviations are preferred.
389

3910
```ruby
@@ -65,4 +36,3 @@ end
6536
```
6637

6738
Above, `get_height()` is public, `get_weight()` is private. You may use the `public` key word below `private`, but generally this is not done.
68-
>>>>>>> Stashed changes

ruby/variable-naming.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,11 @@
1-
<<<<<<< Updated upstream
2-
# Python Naming Convention > Variable Naming
3-
=======
41
# Ruby Naming Convention > Variable Naming
5-
>>>>>>> Stashed changes
62

73
## snake_case
84

95
* Should be all in lowercase
106
* Not begin with the special characters like e.g. & (ampersand), $ (dollar)
117
* If the name contains multiple words, it should be separated by underscores (_) e.g. json_string
128
* Avoid one-character variables e.g. a, b
13-
<<<<<<< Updated upstream
14-
15-
```python
16-
class Student
17-
age = None
18-
...
19-
```
20-
21-
## Private Variable
22-
23-
Python does not support privacy directly. This naming convention is used as a weak internal use indicator.
24-
25-
* Should follow the above naming conventions
26-
* Should use a leading underscore (_) to distinguish between "public" and "private" variables
27-
* For more read the [official python documentation](https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references).
28-
29-
```
30-
class Student:
31-
age = None # public variable
32-
_id = 0 # Private variable
33-
```
34-
35-
36-
37-
=======
389
* Clear and descriptive variable names without abbreviations are preferred.
3910

4011
```ruby
@@ -54,4 +25,3 @@ class Student
5425
```
5526

5627
Other prefixes include '$' for global variables, and '@@' for class variables. But when possible, instance and local variables are preferred.
57-
>>>>>>> Stashed changes

0 commit comments

Comments
 (0)