Module: RSpec::Support::RubyFeatures Private

Defined in:
lib/rspec/support/ruby_features.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Provides query methods for ruby features that differ among implementations.

API:

  • private

Class Method Summary collapse

Class Method Details

.kw_args_supported?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



23
24
25
# File 'lib/rspec/support/ruby_features.rb', line 23

def kw_args_supported?
  RUBY_VERSION >= '2.0.0' && RUBY_ENGINE != 'rbx' && RUBY_ENGINE != 'jruby'
end

.module_prepends_supported?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



33
34
35
# File 'lib/rspec/support/ruby_features.rb', line 33

def module_prepends_supported?
  Module.method_defined?(:prepend) || Module.private_method_defined?(:prepend)
end

.optional_and_splat_args_supported?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



18
19
20
# File 'lib/rspec/support/ruby_features.rb', line 18

def optional_and_splat_args_supported?
  Method.method_defined?(:parameters)
end

.required_kw_args_supported?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



28
29
30
# File 'lib/rspec/support/ruby_features.rb', line 28

def required_kw_args_supported?
  RUBY_VERSION >= '2.1.0' && RUBY_ENGINE != 'rbx' && RUBY_ENGINE != 'jruby'
end

.supports_rebinding_module_methods?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



38
39
40
41
# File 'lib/rspec/support/ruby_features.rb', line 38

def supports_rebinding_module_methods?
  # RBX and JRuby don't yet support this.
  RUBY_VERSION.to_i >= 2 && RUBY_ENGINE != 'rbx' && RUBY_ENGINE != 'jruby'
end