Sha256: f28b61f3a32a25a563d0d39c3db26c47ccb085bb0f726bbd49baa58edc0d9e20

Contents?: true

Size: 1.01 KB

Versions: 1680

Compression:

Stored size: 1.01 KB

Contents

RSpec::Support.require_rspec_support("method_signature_verifier")

module RSpec
  module Support
    module WithKeywordsWhenNeeded
      # This module adds keyword sensitive support for core ruby methods
      # where we cannot use `ruby2_keywords` directly.

      module_function

      if RSpec::Support::RubyFeatures.kw_args_supported?
        # Remove this in RSpec 4 in favour of explictly passed in kwargs where
        # this is used. Works around a warning in Ruby 2.7

        def class_exec(klass, *args, &block)
          if MethodSignature.new(block).has_kw_args_in?(args)
            binding.eval(<<-CODE, __FILE__, __LINE__)
            kwargs = args.pop
            klass.class_exec(*args, **kwargs, &block)
            CODE
          else
            klass.class_exec(*args, &block)
          end
        end
        ruby2_keywords :class_exec if respond_to?(:ruby2_keywords, true)
      else
        def class_exec(klass, *args, &block)
          klass.class_exec(*args, &block)
        end
      end
    end
  end
end

Version data entries

1,680 entries across 1,630 versions & 41 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.19.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.18.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/with_keywords_when_needed.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/with_keywords_when_needed.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.15.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.14.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.13.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.12.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.11.1 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.11.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
primary_connect_proto-0.20.0 vendor/bundle/ruby/3.0.0/gems/rspec-support-3.10.3/lib/rspec/support/with_keywords_when_needed.rb
primary_connect_proto-0.20.0 vendor/bundle/ruby/2.6.0/gems/rspec-support-3.10.3/lib/rspec/support/with_keywords_when_needed.rb
mux_ruby-3.9.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/with_keywords_when_needed.rb
primary_connect_proto-0.19.0 vendor/bundle/ruby/3.0.0/gems/rspec-support-3.10.3/lib/rspec/support/with_keywords_when_needed.rb