123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Support::WithKeywordsWhenNeeded

Relationships & Source Files
Defined in: rspec-support/lib/rspec/support/with_keywords_when_needed.rb

Class Method Summary

Class Method Details

.class_exec(klass, *args, &block) (mod_func)

Remove this in ::RSpec 4 in favour of explicitly passed in kwargs where this is used. Works around a warning in Ruby 2.7

See additional method definition at line 17.

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/with_keywords_when_needed.rb', line 29

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