Sha256: e3ac2ede50d5723c7eb1da7e5b1f3dfe8cf2121a2c787f417fbe71ee12ba6f6a

Contents?: true

Size: 1.04 KB

Versions: 2010

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

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 explicitly 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

2,010 entries across 2,010 versions & 15 rubygems

Version Path
cybrid_api_bank_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_organization_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_bank_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_organization_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_bank_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_organization_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_bank_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_organization_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_bank_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_organization_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_bank_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_organization_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_bank_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb
cybrid_api_id_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.2/lib/rspec/support/with_keywords_when_needed.rb