Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and Replace SLASH and ROOT constants #2256

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

chahmedejaz
Copy link
Contributor

Overview

  • This PR adds the SLASH and ROOT constants and replaces them throughout the agent.
  • I created the ROOT (/) constant because I felt that we are using it in the path's context in many places as well
  • I thought it would be handy to separate it out into a new constant.

Submitter Checklist:

  • Include a link to the related GitHub issue, if applicable
  • Include a security review link, if applicable

Resolves #2153

@github-actions github-actions bot added the community To tag external issues and PRs submitted by the community label Oct 12, 2023
@@ -9,7 +9,7 @@
module NewRelic
module Agent
class RulesEngine
SEGMENT_SEPARATOR = '/'.freeze
SEGMENT_SEPARATOR = NewRelic::SLASH
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assigned the SLASH to SEGMENT_SEPARATOR because I felt, the SEGMENT_SEPARATOR is the best name for the context for SLASH here. Please let me know if you think otherwise.

Copy link
Contributor

@fallwith fallwith Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having one constant reference another gives us the benefit of using a more context-specific name while still minimizing resources and not* maintaining two copies of the same frozen string. I really like your approach here, @chahmedejaz.

Copy link
Contributor

@fallwith fallwith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution, @chahmedejaz! I'll let the automated unit tests run and as long as they pass with the changes, we'll get this one merged. These changes will provide improved performance for customers and are appreciated!

@@ -9,7 +9,7 @@
module NewRelic
module Agent
class RulesEngine
SEGMENT_SEPARATOR = '/'.freeze
SEGMENT_SEPARATOR = NewRelic::SLASH
Copy link
Contributor

@fallwith fallwith Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having one constant reference another gives us the benefit of using a more context-specific name while still minimizing resources and not* maintaining two copies of the same frozen string. I really like your approach here, @chahmedejaz.

@fallwith fallwith merged commit 4c23625 into newrelic:dev Oct 12, 2023
26 checks passed
@chahmedejaz
Copy link
Contributor Author

Thank you very much for your contribution, @chahmedejaz! I'll let the automated unit tests run and as long as they pass with the changes, we'll get this one merged. These changes will provide improved performance for customers and are appreciated!

It was a pleasure working on this. Thanks for giving me the opportunity! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community To tag external issues and PRs submitted by the community hacktoberfest-accepted
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add '/'.freeze to constants.rb
2 participants