-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
-
None
-
Fully Compatible
Currently Int32/Int64 constructors require Integer objects, and fail when given objects of their own class:
irb(main):001:0> a=BSON::Int64.new(1) => #<BSON::Int64:0x000055770cbdc148 @integer=1> irb(main):002:0> a=BSON::Int64.new(a) Traceback (most recent call last): 6: from /home/me/.rbenv/versions/2.6/bin/irb:23:in `<main>' 5: from /home/me/.rbenv/versions/2.6/bin/irb:23:in `load' 4: from /home/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>' 3: from (irb):2 2: from (irb):2:in `new' 1: from /home/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bson-4.5.0/lib/bson/int64.rb:55:in `initialize' NoMethodError (undefined method `bson_int64?' for #<BSON::Int64:0x000055770cbdc148 @integer=1>) Did you mean? bson_type
This makes it awkward for calling code to instantiate Int32/Int64 objects.
Instead constructors should accept parameters of the same class as the one being constructed.
- is depended on by
-
RUBY-1980 Ensure cursor IDs are always encoded as 64-bit integers in BSON for getMore
- Closed
- links to