Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/mongo/server/app_metadata/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ def initialize(metadata)
@metadata = metadata
end

# Queries whether the current runtime is JRuby or not.
# Queries whether the current runtime is Ruby or not.
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The comment is unclear. Since this method is always called within a Ruby runtime, it should clarify that it checks for standard Ruby/MRI specifically, not whether Ruby is running. Consider: 'Queries whether the current runtime is standard Ruby (MRI).'

Copilot uses AI. Check for mistakes.
#
# @return [ true | false ] whether the runtime is JRuby or not.
def jruby?
BSON::Environment.jruby?
# @return [ Boolean ] whether the current runtime is Ruby
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The return value documentation is incomplete and unclear. It should specify 'whether the current runtime is standard Ruby (MRI)' to distinguish from other Ruby implementations.

Copilot uses AI. Check for mistakes.
def ruby?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"mri" ("matz's ruby implementation") is how the canonical implementation is usually called. It might be better to name this predicate mri? to reflect that, since ruby? is probably overly broad.

Suggested change
def ruby?
def mri?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed!

RUBY_ENGINE == 'ruby'
end

# Returns the list of Ruby versions that identify this runtime.
#
# @return [ Array<String> ] the list of ruby versions
def ruby_versions
if jruby?
[ "JRuby #{JRUBY_VERSION}", "like Ruby #{RUBY_VERSION}" ]
else
if ruby?
[ "Ruby #{RUBY_VERSION}" ]
else
[ "#{RUBY_ENGINE} #{RUBY_ENGINE_VERSION}", "like Ruby #{RUBY_VERSION}" ]
end
end

Expand Down
Loading