- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
ID: ruby-best-practices/double-colon-method-calls
Language: Ruby
Severity: Notice
Category: Best Practices
In Ruby, double colons ::
are used as a namespace resolution operator that allows you to reference constants, including classes and modules, from within different scopes. This rule emphasizes that you should only use double colons to reference these constants.
Using double colons for methods or variables can lead to confusion and unexpected behavior because it deviates from the standard Ruby syntax. It’s important to use the correct operators for clarity and to maintain consistency in your code.
To avoid violating this rule, always use a dot .
when you want to call a method on an object or class. If you want to reference a constant, use double colons ::
. By following these guidelines, your code will be more readable and easier to understand.
SomeClass::some_method
some_object::some_method
SomeClass.some_method
some_object.some_method
SomeModule::SomeClass::SOMETHING
SomeModule::SomeClass()
|
|
For more information, please read the Code Analysis documentation
Identify code vulnerabilities directly in yourVS Code editor
Identify code vulnerabilities directly inJetBrains products