Project

General

Profile

Actions

Bug #20871

closed

Including methods in Enumerable doesn't make them available in Array

Added by sanderd17 (Sander Deryckere) 13 days ago. Updated about 16 hours ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:119751]

Description

Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the Array class weren't loaded anymore.

The core-extensions code looks like this:


module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable

After some debugging, it turned out that the average method was included in the instance_methods of Enumerable, but not in the instance_methods of Array.

Explicitly adding Array.include CoreExt::Enumerable fixes CI for our case.

The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726

Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like1