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

RUBY-2846 use BSON _bson_to_i method if it exists #5473

Merged
merged 3 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion gemfiles/bson_master.gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"
gemspec path: '..'

gem 'bson', git: "https://github.com/mongodb/bson-ruby"
gem 'bson', git: "https://github.com/mongodb/bson-ruby", branch: "RUBY-2896"
Neilshweky marked this conversation as resolved.
Show resolved Hide resolved
gem 'mongo'

gem 'actionpack'
Expand Down
5 changes: 3 additions & 2 deletions lib/mongoid/extensions/time_with_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ def mongoize
end

# This code is copied from Time class extension in bson-ruby gem. It
# should be removed from here when added to bson-ruby.
# See https://jira.mongodb.org/browse/RUBY-2846.
# should be removed from here when the minimum BSON version is 5+.
# See https://jira.mongodb.org/browse/MONGOID-5491.
def _bson_to_i
return super if defined?(super)
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, didn't realize defined?(super) is a thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

me neither!

# Workaround for JRuby's #to_i rounding negative timestamps up
# rather than down (https://github.com/jruby/jruby/issues/6104)
if BSON::Environment.jruby?
Expand Down