Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-641

BSON::OrderedHash should allow options extraction using Array#extract_options!

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 1.8.6
    • 1.9.1
    • BSON
    • Ubuntu 12.04, Ruby 1.9.3-p327, activesupport 3.2.13, bson 1.8.6

    Description

      There's a commonly used approach to extract options from method arguments using Array#extract_options!

      Example:

      require 'active_support'
       
      def foo(*args)
        args.extract_options!
      end
       
      foo(1, 1, { :some => 'hash' })  # => { :some => 'hash' } 

      However when using `bson` gem inside a project the example above returns {}.

      ActiveSupport requires BSON::OrderedHash to implement method #extractable_options? to support options extraction. See https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/array/extract_options.rb#L7

      Expected result: It should still be possible to use Array#extract_options! if a gem has dependency on `bson`

      Attachments

        Activity

          People

            tyler@10gen.com Tyler Brock
            roody Konstantin Rudy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: