airbnb / airbnb/ruby

Nested or Compact Class and Module naming style?

Open
#199 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
3.9k
Forks
756
PR merge metrics
No merged PRs in 30d

Description

Hi, is there any specific style that you guys follow for class and module naming style, either nested or compact??
In the rubystyle guide they prefer nested due to surprising constant lookups

> Using the scope resolution operator can lead to surprising constant lookups due to Ruby’s [lexical scoping](https://cirw.in/blog/constant-lookup.html)
> ref: https://rubystyle.guide/#namespace-definition

example of nested:
```
class Foo
class Bar
end
end
```

example of compact:
```
class Foo::Bar
end
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.