Sha256: 97fbc7d56e10d72714222a201e9baf3c9e690ec2f4ba05e9bf86f64b8f0fcba0

Contents?: true

Size: 1.29 KB

Versions: 39

Compression:

Stored size: 1.29 KB

Contents

require 'power_assert/configuration'

if defined?(RubyVM)
  if PowerAssert.configuration._redefinition
    module PowerAssert
      # set redefined flag
      basic_classes = [
        Integer, Float, String, Array, Hash, Symbol, Time, Regexp, NilClass, TrueClass, FalseClass
      ]

      verbose = $VERBOSE
      begin
        $VERBOSE = nil
        [:Fixnum, :Bignum].each do |c|
          if Object.const_defined?(c) and (c = Object.const_get(c)) != Integer
            basic_classes << c
          end
        end
      ensure
        $VERBOSE = verbose
      end

      basic_operators = [
        :+, :-, :*, :/, :%, :==, :===, :<, :<=, :<<, :[], :[]=,
        :length, :size, :empty?, :succ, :>, :>=, :!, :!=, :=~, :freeze, :-@, :max, :min, :nil?
      ]

      basic_classes.each do |klass|
        basic_operators.each do |bop|
          if klass.public_method_defined?(bop)
            refine(klass) do
              define_method(bop) {}
            end
          end
        end
      end

      # bypass check_cfunc
      refine BasicObject do
        def !
        end

        def ==
        end
      end

      refine Module do
        def ==
        end
      end
    end
  end

  # disable optimization
  RubyVM::InstructionSequence.compile_option = {
    specialized_instruction: false
  }
end

Version data entries

39 entries across 33 versions & 7 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
wallee-ruby-sdk-3.2.0 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
postfinancecheckout-ruby-sdk-3.2.0 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
wallee-ruby-sdk-3.1.5 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
postfinancecheckout-ruby-sdk-3.1.5 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.2.0 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.9 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.8 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.7 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.6 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.5 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
postfinancecheckout-ruby-sdk-3.1.4 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.4 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
wallee-ruby-sdk-3.1.4 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
wallee-ruby-sdk-3.1.3 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.3 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
whitelabelmachinename-ruby-sdk-3.1.2 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
wallee-ruby-sdk-3.1.2 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb
wallee-ruby-sdk-3.1.1 vendor/bundle/ruby/2.4.0/gems/power_assert-2.0.1/lib/power_assert/enable_tracepoint_events.rb