module Persistent💎::JRuby92SetWorkaround

Workaround for github.com/jruby/jruby/issues/5227 We monkey patch the Ruby Set methods affected to restore their interoperable behavior

Public Class Methods

workaround_needed?() click to toggle source
# File lib/persistent_dmnd/jruby_9_2_set_workaround.rb, line 22
def self.workaround_needed?
  workaround_checker = Object.new
  workaround_checker.instance_eval do
    def is_a?(klass)
      super || klass == Set
    end

    def size
      0
    end

    def all?
      false
    end
  end

  begin
    Set.new.superset?(workaround_checker)
    false
  rescue ArgumentError => e
    e.message == "value must be a set"
  end
end

Public Instance Methods

all?() click to toggle source
# File lib/persistent_dmnd/jruby_9_2_set_workaround.rb, line 33
def all?
  false
end
is_a?(klass) click to toggle source
Calls superclass method
# File lib/persistent_dmnd/jruby_9_2_set_workaround.rb, line 25
def is_a?(klass)
  super || klass == Set
end
size() click to toggle source
# File lib/persistent_dmnd/jruby_9_2_set_workaround.rb, line 29
def size
  0
end