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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.caller_locations_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:

  • (Boolean)


85
86
87
# File 'lib/rspec/support/ruby_features.rb', line 85

def caller_locations_supported?
  respond_to?(:caller_locations, true)
end

.distincts_kw_args_from_positional_hash?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:

  • (Boolean)


155
156
157
# File 'lib/rspec/support/ruby_features.rb', line 155

def distincts_kw_args_from_positional_hash?
  RUBY_VERSION >= '3.0.0'
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:

  • (Boolean)


216
217
218
# File 'lib/rspec/support/ruby_features.rb', line 216

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

.module_refinement_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:

  • (Boolean)


212
213
214
# File 'lib/rspec/support/ruby_features.rb', line 212

def module_refinement_supported?
  Module.method_defined?(:refine) || Module.private_method_defined?(:refine)
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:

  • (Boolean)


81
82
83
# File 'lib/rspec/support/ruby_features.rb', line 81

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

Instance Method Details

#fork_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.

On JRuby 1.7 ‘–1.8` mode, `Process.respond_to?(:fork)` returns true, but when you try to fork, it raises an error:

NotImplementedError: fork is not available on this platform

When we drop support for JRuby 1.7 and/or Ruby 1.8, we can drop this special case.

Returns:

  • (Boolean)


72
73
74
# File 'lib/rspec/support/ruby_features.rb', line 72

def fork_supported?
  false
end

#kw_arg_separation?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.

rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments

Returns:

  • (Boolean)


111
112
113
# File 'lib/rspec/support/ruby_features.rb', line 111

def kw_arg_separation?
  true
end

#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:

  • (Boolean)


160
161
162
# File 'lib/rspec/support/ruby_features.rb', line 160

def kw_args_supported?
  RUBY_VERSION >= '2.0.0'
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:

  • (Boolean)


164
165
166
# File 'lib/rspec/support/ruby_features.rb', line 164

def required_kw_args_supported?
  RUBY_VERSION >= '2.1.0'
end

#ripper_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:

  • (Boolean)


146
147
148
# File 'lib/rspec/support/ruby_features.rb', line 146

def ripper_supported?
  true
end

#supports_exception_cause?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:

  • (Boolean)


90
91
92
# File 'lib/rspec/support/ruby_features.rb', line 90

def supports_exception_cause?
  true
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:

  • (Boolean)


168
169
170
# File 'lib/rspec/support/ruby_features.rb', line 168

def supports_rebinding_module_methods?
  RUBY_VERSION.to_i >= 2
end

#supports_syntax_suggest?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:

  • (Boolean)


100
101
102
# File 'lib/rspec/support/ruby_features.rb', line 100

def supports_syntax_suggest?
  true
end

#supports_taint?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:

  • (Boolean)


121
122
123
# File 'lib/rspec/support/ruby_features.rb', line 121

def supports_taint?
  false
end