Skip to content

Checkout method with default scope raises exception if used from Ruby < 2.2.0 #5

@skyuchukov-bp

Description

@skyuchukov-bp

Steps:
Using an example similar to the one from the README.md

$redis_pond.checkout do |redis|
  ...
end

on a Ruby version prior to 2.2.0 (tested with 2.1.5).

Actual result: Exception raised - Can't checkout with a non-frozen scope.
Expected result: Checking out an instance from the pool and executing the code from the block on it.
Affected gem versions: 0.3.0, 0.4.0

Analysis:
The code in checkout (sensibly) guards against non-frozen scope being passed.
This scope parameter is not required - it has a default value of nil, which is being utilized in the above scenario.

Before Ruby 2.2.0 though, the nil value itself is not frozen (at least not in the way frozen? would report): https://bugs.ruby-lang.org/issues/8923

P.s. The scope parameter is not really documented too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions